env

package
v0.0.0-...-93ecd0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewkvGetterGetInvocation

func NewkvGetterGetInvocation(ident1 string, ident2 *consul.QueryOptions, ident3 *consul.KVPair, ident4 *consul.QueryMeta, ident5 error) *kvGetterGetInvocation

NewkvGetterGetInvocation creates a new instance of kvGetterGetInvocation

func NewkvGetterListInvocation

func NewkvGetterListInvocation(ident1 string, ident2 *consul.QueryOptions, ident3 consul.KVPairs, ident4 *consul.QueryMeta, ident5 error) *kvGetterListInvocation

NewkvGetterListInvocation creates a new instance of kvGetterListInvocation

func NewlogicalReaderReadInvocation

func NewlogicalReaderReadInvocation(path string, ident1 *vault.Secret, ident2 error) *logicalReaderReadInvocation

NewlogicalReaderReadInvocation creates a new instance of logicalReaderReadInvocation

Types

type ConsulProvider

type ConsulProvider struct {
	ErrorHandler ErrorHandler
	// contains filtered or unexported fields
}

func NewConsul

func NewConsul(c *consul.Client, prefix string) *ConsulProvider

func (*ConsulProvider) Get

func (p *ConsulProvider) Get(name string) (string, merry.Error)

func (*ConsulProvider) GetBool

func (p *ConsulProvider) GetBool(name string) (bool, merry.Error)

func (*ConsulProvider) GetInt

func (p *ConsulProvider) GetInt(name string) (int, merry.Error)

func (*ConsulProvider) Healthcheck

func (p *ConsulProvider) Healthcheck(context.Context) merry.Error

func (*ConsulProvider) IsMonitoring

func (p *ConsulProvider) IsMonitoring() bool

func (*ConsulProvider) Monitor

func (p *ConsulProvider) Monitor(key string, v chan<- env.Value)

func (*ConsulProvider) Shutdown

func (p *ConsulProvider) Shutdown()

type ErrorHandler

type ErrorHandler func(error)

type FakekvGetter

type FakekvGetter struct {
	GetHook  func(string, *consul.QueryOptions) (*consul.KVPair, *consul.QueryMeta, error)
	ListHook func(string, *consul.QueryOptions) (consul.KVPairs, *consul.QueryMeta, error)

	GetCalls  []*kvGetterGetInvocation
	ListCalls []*kvGetterListInvocation
}

FakekvGetter is a mock implementation of kvGetter for testing. Use it in your tests as in this example:

package example

func TestWithkvGetter(t *testing.T) {
	f := &env.FakekvGetter{
		GetHook: func(ident1 string, ident2 *consul.QueryOptions) (ident3 *consul.KVPair, ident4 *consul.QueryMeta, ident5 error) {
			// ensure parameters meet expections, signal errors using t, etc
			return
		},
	}

	// test code goes here ...

	// assert state of FakeGet ...
	f.AssertGetCalledOnce(t)
}

Create anonymous function implementations for only those interface methods that should be called in the code under test. This will force a panic if any unexpected calls are made to FakeGet.

func NewFakekvGetterDefaultError

func NewFakekvGetterDefaultError(t kvGetterTestingT) *FakekvGetter

NewFakekvGetterDefaultError returns an instance of FakekvGetter with all hooks configured to call t.Error

func NewFakekvGetterDefaultFatal

func NewFakekvGetterDefaultFatal(t kvGetterTestingT) *FakekvGetter

NewFakekvGetterDefaultFatal returns an instance of FakekvGetter with all hooks configured to call t.Fatal

func NewFakekvGetterDefaultPanic

func NewFakekvGetterDefaultPanic() *FakekvGetter

NewFakekvGetterDefaultPanic returns an instance of FakekvGetter with all hooks configured to panic

func (*FakekvGetter) AssertGetCalled

func (f *FakekvGetter) AssertGetCalled(t kvGetterTestingT)

AssertGetCalled calls t.Error if FakekvGetter.Get was not called

func (*FakekvGetter) AssertGetCalledN

func (f *FakekvGetter) AssertGetCalledN(t kvGetterTestingT, n int)

AssertGetCalledN calls t.Error if FakekvGetter.Get was called less than n times

func (*FakekvGetter) AssertGetCalledOnce

func (f *FakekvGetter) AssertGetCalledOnce(t kvGetterTestingT)

AssertGetCalledOnce calls t.Error if FakekvGetter.Get was not called exactly once

func (*FakekvGetter) AssertGetCalledOnceWith

func (_f9 *FakekvGetter) AssertGetCalledOnceWith(t kvGetterTestingT, ident1 string, ident2 *consul.QueryOptions)

AssertGetCalledOnceWith calls t.Error if FakekvGetter.Get was not called exactly once with the given values

func (*FakekvGetter) AssertGetCalledWith

func (_f7 *FakekvGetter) AssertGetCalledWith(t kvGetterTestingT, ident1 string, ident2 *consul.QueryOptions)

AssertGetCalledWith calls t.Error if FakekvGetter.Get was not called with the given values

func (*FakekvGetter) AssertGetNotCalled

func (f *FakekvGetter) AssertGetNotCalled(t kvGetterTestingT)

AssertGetNotCalled calls t.Error if FakekvGetter.Get was called

func (*FakekvGetter) AssertListCalled

func (f *FakekvGetter) AssertListCalled(t kvGetterTestingT)

AssertListCalled calls t.Error if FakekvGetter.List was not called

func (*FakekvGetter) AssertListCalledN

func (f *FakekvGetter) AssertListCalledN(t kvGetterTestingT, n int)

AssertListCalledN calls t.Error if FakekvGetter.List was called less than n times

func (*FakekvGetter) AssertListCalledOnce

func (f *FakekvGetter) AssertListCalledOnce(t kvGetterTestingT)

AssertListCalledOnce calls t.Error if FakekvGetter.List was not called exactly once

func (*FakekvGetter) AssertListCalledOnceWith

func (_f19 *FakekvGetter) AssertListCalledOnceWith(t kvGetterTestingT, ident1 string, ident2 *consul.QueryOptions)

AssertListCalledOnceWith calls t.Error if FakekvGetter.List was not called exactly once with the given values

func (*FakekvGetter) AssertListCalledWith

func (_f17 *FakekvGetter) AssertListCalledWith(t kvGetterTestingT, ident1 string, ident2 *consul.QueryOptions)

AssertListCalledWith calls t.Error if FakekvGetter.List was not called with the given values

func (*FakekvGetter) AssertListNotCalled

func (f *FakekvGetter) AssertListNotCalled(t kvGetterTestingT)

AssertListNotCalled calls t.Error if FakekvGetter.List was called

func (*FakekvGetter) Get

func (_f1 *FakekvGetter) Get(ident1 string, ident2 *consul.QueryOptions) (ident3 *consul.KVPair, ident4 *consul.QueryMeta, ident5 error)

func (*FakekvGetter) GetCalled

func (f *FakekvGetter) GetCalled() bool

GetCalled returns true if FakekvGetter.Get was called

func (*FakekvGetter) GetCalledN

func (f *FakekvGetter) GetCalledN(n int) bool

GetCalledN returns true if FakekvGetter.Get was called at least n times

func (*FakekvGetter) GetCalledOnce

func (f *FakekvGetter) GetCalledOnce() bool

GetCalledOnce returns true if FakekvGetter.Get was called exactly once

func (*FakekvGetter) GetCalledOnceWith

func (_f8 *FakekvGetter) GetCalledOnceWith(ident1 string, ident2 *consul.QueryOptions) bool

GetCalledOnceWith returns true if FakekvGetter.Get was called exactly once with the given values

func (*FakekvGetter) GetCalledWith

func (_f6 *FakekvGetter) GetCalledWith(ident1 string, ident2 *consul.QueryOptions) (found bool)

GetCalledWith returns true if FakekvGetter.Get was called with the given values

func (*FakekvGetter) GetNotCalled

func (f *FakekvGetter) GetNotCalled() bool

GetNotCalled returns true if FakekvGetter.Get was not called

func (*FakekvGetter) GetResultsForCall

func (_f10 *FakekvGetter) GetResultsForCall(ident1 string, ident2 *consul.QueryOptions) (ident3 *consul.KVPair, ident4 *consul.QueryMeta, ident5 error, found bool)

GetResultsForCall returns the result values for the first call to FakekvGetter.Get with the given values

func (*FakekvGetter) List

func (_f11 *FakekvGetter) List(ident1 string, ident2 *consul.QueryOptions) (ident3 consul.KVPairs, ident4 *consul.QueryMeta, ident5 error)

func (*FakekvGetter) ListCalled

func (f *FakekvGetter) ListCalled() bool

ListCalled returns true if FakekvGetter.List was called

func (*FakekvGetter) ListCalledN

func (f *FakekvGetter) ListCalledN(n int) bool

ListCalledN returns true if FakekvGetter.List was called at least n times

func (*FakekvGetter) ListCalledOnce

func (f *FakekvGetter) ListCalledOnce() bool

ListCalledOnce returns true if FakekvGetter.List was called exactly once

func (*FakekvGetter) ListCalledOnceWith

func (_f18 *FakekvGetter) ListCalledOnceWith(ident1 string, ident2 *consul.QueryOptions) bool

ListCalledOnceWith returns true if FakekvGetter.List was called exactly once with the given values

func (*FakekvGetter) ListCalledWith

func (_f16 *FakekvGetter) ListCalledWith(ident1 string, ident2 *consul.QueryOptions) (found bool)

ListCalledWith returns true if FakekvGetter.List was called with the given values

func (*FakekvGetter) ListNotCalled

func (f *FakekvGetter) ListNotCalled() bool

ListNotCalled returns true if FakekvGetter.List was not called

func (*FakekvGetter) ListResultsForCall

func (_f20 *FakekvGetter) ListResultsForCall(ident1 string, ident2 *consul.QueryOptions) (ident3 consul.KVPairs, ident4 *consul.QueryMeta, ident5 error, found bool)

ListResultsForCall returns the result values for the first call to FakekvGetter.List with the given values

func (*FakekvGetter) Reset

func (f *FakekvGetter) Reset()

func (*FakekvGetter) SetGetInvocation

func (_f3 *FakekvGetter) SetGetInvocation(calls_f4 []*kvGetterGetInvocation, fallback_f5 func() (*consul.KVPair, *consul.QueryMeta, error))

SetGetInvocation configures kvGetter.Get to return the given results when called with the given parameters If no match is found for an invocation the result(s) of the fallback function are returned

func (*FakekvGetter) SetGetStub

func (_f2 *FakekvGetter) SetGetStub(ident3 *consul.KVPair, ident4 *consul.QueryMeta, ident5 error)

SetGetStub configures kvGetter.Get to always return the given values

func (*FakekvGetter) SetListInvocation

func (_f13 *FakekvGetter) SetListInvocation(calls_f14 []*kvGetterListInvocation, fallback_f15 func() (consul.KVPairs, *consul.QueryMeta, error))

SetListInvocation configures kvGetter.List to return the given results when called with the given parameters If no match is found for an invocation the result(s) of the fallback function are returned

func (*FakekvGetter) SetListStub

func (_f12 *FakekvGetter) SetListStub(ident3 consul.KVPairs, ident4 *consul.QueryMeta, ident5 error)

SetListStub configures kvGetter.List to always return the given values

type FakelogicalReader

type FakelogicalReader struct {
	ReadHook func(string) (*vault.Secret, error)

	ReadCalls []*logicalReaderReadInvocation
}

FakelogicalReader is a mock implementation of logicalReader for testing. Use it in your tests as in this example:

package example

func TestWithlogicalReader(t *testing.T) {
	f := &env.FakelogicalReader{
		ReadHook: func(path string) (ident1 *vault.Secret, ident2 error) {
			// ensure parameters meet expections, signal errors using t, etc
			return
		},
	}

	// test code goes here ...

	// assert state of FakeRead ...
	f.AssertReadCalledOnce(t)
}

Create anonymous function implementations for only those interface methods that should be called in the code under test. This will force a panic if any unexpected calls are made to FakeRead.

func NewFakelogicalReaderDefaultError

func NewFakelogicalReaderDefaultError(t logicalReaderTestingT) *FakelogicalReader

NewFakelogicalReaderDefaultError returns an instance of FakelogicalReader with all hooks configured to call t.Error

func NewFakelogicalReaderDefaultFatal

func NewFakelogicalReaderDefaultFatal(t logicalReaderTestingT) *FakelogicalReader

NewFakelogicalReaderDefaultFatal returns an instance of FakelogicalReader with all hooks configured to call t.Fatal

func NewFakelogicalReaderDefaultPanic

func NewFakelogicalReaderDefaultPanic() *FakelogicalReader

NewFakelogicalReaderDefaultPanic returns an instance of FakelogicalReader with all hooks configured to panic

func (*FakelogicalReader) AssertReadCalled

func (f *FakelogicalReader) AssertReadCalled(t logicalReaderTestingT)

AssertReadCalled calls t.Error if FakelogicalReader.Read was not called

func (*FakelogicalReader) AssertReadCalledN

func (f *FakelogicalReader) AssertReadCalledN(t logicalReaderTestingT, n int)

AssertReadCalledN calls t.Error if FakelogicalReader.Read was called less than n times

func (*FakelogicalReader) AssertReadCalledOnce

func (f *FakelogicalReader) AssertReadCalledOnce(t logicalReaderTestingT)

AssertReadCalledOnce calls t.Error if FakelogicalReader.Read was not called exactly once

func (*FakelogicalReader) AssertReadCalledOnceWith

func (_f9 *FakelogicalReader) AssertReadCalledOnceWith(t logicalReaderTestingT, path string)

AssertReadCalledOnceWith calls t.Error if FakelogicalReader.Read was not called exactly once with the given values

func (*FakelogicalReader) AssertReadCalledWith

func (_f7 *FakelogicalReader) AssertReadCalledWith(t logicalReaderTestingT, path string)

AssertReadCalledWith calls t.Error if FakelogicalReader.Read was not called with the given values

func (*FakelogicalReader) AssertReadNotCalled

func (f *FakelogicalReader) AssertReadNotCalled(t logicalReaderTestingT)

AssertReadNotCalled calls t.Error if FakelogicalReader.Read was called

func (*FakelogicalReader) Read

func (_f1 *FakelogicalReader) Read(path string) (ident1 *vault.Secret, ident2 error)

func (*FakelogicalReader) ReadCalled

func (f *FakelogicalReader) ReadCalled() bool

ReadCalled returns true if FakelogicalReader.Read was called

func (*FakelogicalReader) ReadCalledN

func (f *FakelogicalReader) ReadCalledN(n int) bool

ReadCalledN returns true if FakelogicalReader.Read was called at least n times

func (*FakelogicalReader) ReadCalledOnce

func (f *FakelogicalReader) ReadCalledOnce() bool

ReadCalledOnce returns true if FakelogicalReader.Read was called exactly once

func (*FakelogicalReader) ReadCalledOnceWith

func (_f8 *FakelogicalReader) ReadCalledOnceWith(path string) bool

ReadCalledOnceWith returns true if FakelogicalReader.Read was called exactly once with the given values

func (*FakelogicalReader) ReadCalledWith

func (_f6 *FakelogicalReader) ReadCalledWith(path string) (found bool)

ReadCalledWith returns true if FakelogicalReader.Read was called with the given values

func (*FakelogicalReader) ReadNotCalled

func (f *FakelogicalReader) ReadNotCalled() bool

ReadNotCalled returns true if FakelogicalReader.Read was not called

func (*FakelogicalReader) ReadResultsForCall

func (_f10 *FakelogicalReader) ReadResultsForCall(path string) (ident1 *vault.Secret, ident2 error, found bool)

ReadResultsForCall returns the result values for the first call to FakelogicalReader.Read with the given values

func (*FakelogicalReader) Reset

func (f *FakelogicalReader) Reset()

func (*FakelogicalReader) SetReadInvocation

func (_f3 *FakelogicalReader) SetReadInvocation(calls_f4 []*logicalReaderReadInvocation, fallback_f5 func() (*vault.Secret, error))

SetReadInvocation configures logicalReader.Read to return the given results when called with the given parameters If no match is found for an invocation the result(s) of the fallback function are returned

func (*FakelogicalReader) SetReadStub

func (_f2 *FakelogicalReader) SetReadStub(ident1 *vault.Secret, ident2 error)

SetReadStub configures logicalReader.Read to always return the given values

type Fakeselfer

type Fakeselfer struct {
	SelfHook func() (map[string]map[string]interface{}, error)

	SelfCalls []*selferSelfInvocation
}

Fakeselfer is a mock implementation of selfer for testing. Use it in your tests as in this example:

package example

func TestWithselfer(t *testing.T) {
	f := &env.Fakeselfer{
		SelfHook: func() (ident1 map[string]map[string]interface{}, ident2 error) {
			// ensure parameters meet expections, signal errors using t, etc
			return
		},
	}

	// test code goes here ...

	// assert state of FakeSelf ...
	f.AssertSelfCalledOnce(t)
}

Create anonymous function implementations for only those interface methods that should be called in the code under test. This will force a panic if any unexpected calls are made to FakeSelf.

func NewFakeselferDefaultError

func NewFakeselferDefaultError(t selferTestingT) *Fakeselfer

NewFakeselferDefaultError returns an instance of Fakeselfer with all hooks configured to call t.Error

func NewFakeselferDefaultFatal

func NewFakeselferDefaultFatal(t selferTestingT) *Fakeselfer

NewFakeselferDefaultFatal returns an instance of Fakeselfer with all hooks configured to call t.Fatal

func NewFakeselferDefaultPanic

func NewFakeselferDefaultPanic() *Fakeselfer

NewFakeselferDefaultPanic returns an instance of Fakeselfer with all hooks configured to panic

func (*Fakeselfer) AssertSelfCalled

func (f *Fakeselfer) AssertSelfCalled(t selferTestingT)

AssertSelfCalled calls t.Error if Fakeselfer.Self was not called

func (*Fakeselfer) AssertSelfCalledN

func (f *Fakeselfer) AssertSelfCalledN(t selferTestingT, n int)

AssertSelfCalledN calls t.Error if Fakeselfer.Self was called less than n times

func (*Fakeselfer) AssertSelfCalledOnce

func (f *Fakeselfer) AssertSelfCalledOnce(t selferTestingT)

AssertSelfCalledOnce calls t.Error if Fakeselfer.Self was not called exactly once

func (*Fakeselfer) AssertSelfNotCalled

func (f *Fakeselfer) AssertSelfNotCalled(t selferTestingT)

AssertSelfNotCalled calls t.Error if Fakeselfer.Self was called

func (*Fakeselfer) Reset

func (f *Fakeselfer) Reset()

func (*Fakeselfer) Self

func (_f1 *Fakeselfer) Self() (ident1 map[string]map[string]interface{}, ident2 error)

func (*Fakeselfer) SelfCalled

func (f *Fakeselfer) SelfCalled() bool

SelfCalled returns true if Fakeselfer.Self was called

func (*Fakeselfer) SelfCalledN

func (f *Fakeselfer) SelfCalledN(n int) bool

SelfCalledN returns true if Fakeselfer.Self was called at least n times

func (*Fakeselfer) SelfCalledOnce

func (f *Fakeselfer) SelfCalledOnce() bool

SelfCalledOnce returns true if Fakeselfer.Self was called exactly once

func (*Fakeselfer) SelfNotCalled

func (f *Fakeselfer) SelfNotCalled() bool

SelfNotCalled returns true if Fakeselfer.Self was not called

func (*Fakeselfer) SetSelfStub

func (_f2 *Fakeselfer) SetSelfStub(ident1 map[string]map[string]interface{}, ident2 error)

SetSelfStub configures selfer.Self to always return the given values

type VaultProvider

type VaultProvider struct {
	// contains filtered or unexported fields
}

func NewVault

func NewVault(c *vault.Client, prefix string) *VaultProvider

func (*VaultProvider) Get

func (v *VaultProvider) Get(name string) (string, merry.Error)

func (*VaultProvider) GetBool

func (v *VaultProvider) GetBool(name string) (bool, merry.Error)

func (*VaultProvider) GetInt

func (v *VaultProvider) GetInt(name string) (int, merry.Error)

func (*VaultProvider) Monitor

func (v *VaultProvider) Monitor(name string, ch chan<- env.Value)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL