env

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NameNotSet = merry.New("name not set")
	NameEmpty  = merry.New("name has empty value")
)
View Source
var (
	DefaultProvider = NewSystem()
)

Functions

func Get

func Get(name string) (string, merry.Error)

func GetBool

func GetBool(name string) (bool, merry.Error)

func GetInt

func GetInt(name string) (int, merry.Error)

func NewkvGetterGetInvocation added in v0.3.1

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 added in v0.3.1

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 added in v0.4.2

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

NewlogicalReaderReadInvocation creates a new instance of logicalReaderReadInvocation

Types

type ConsulProvider added in v0.3.1

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

func NewConsul added in v0.3.0

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

func (*ConsulProvider) Get added in v0.3.1

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

func (*ConsulProvider) GetBool added in v0.3.1

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

func (*ConsulProvider) GetInt added in v0.3.1

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

func (*ConsulProvider) Healthcheck added in v0.3.1

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

func (*ConsulProvider) IsMonitoring added in v0.3.1

func (p *ConsulProvider) IsMonitoring() bool

func (*ConsulProvider) Monitor added in v0.3.1

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

func (*ConsulProvider) Shutdown added in v0.3.1

func (p *ConsulProvider) Shutdown()

type ErrorHandler added in v0.3.0

type ErrorHandler func(error)

type FakeProvider added in v0.3.0

type FakeProvider struct {
	GetHook     func(string) (string, merry.Error)
	GetIntHook  func(string) (int, merry.Error)
	GetBoolHook func(string) (bool, merry.Error)
	MonitorHook func(string, chan<- Value)

	GetCalls     []*ProviderGetInvocation
	GetIntCalls  []*ProviderGetIntInvocation
	GetBoolCalls []*ProviderGetBoolInvocation
	MonitorCalls []*ProviderMonitorInvocation
}

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

package example

func TestWithProvider(t *testing.T) {
	f := &env.FakeProvider{
		GetHook: func(ident1 string) (ident2 string, ident3 merry.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 NewFakeProviderDefaultError added in v0.3.0

func NewFakeProviderDefaultError(t ProviderTestingT) *FakeProvider

NewFakeProviderDefaultError returns an instance of FakeProvider with all hooks configured to call t.Error

func NewFakeProviderDefaultFatal added in v0.3.0

func NewFakeProviderDefaultFatal(t ProviderTestingT) *FakeProvider

NewFakeProviderDefaultFatal returns an instance of FakeProvider with all hooks configured to call t.Fatal

func NewFakeProviderDefaultPanic added in v0.3.0

func NewFakeProviderDefaultPanic() *FakeProvider

NewFakeProviderDefaultPanic returns an instance of FakeProvider with all hooks configured to panic

func (*FakeProvider) AssertGetBoolCalled added in v0.3.0

func (f *FakeProvider) AssertGetBoolCalled(t ProviderTestingT)

AssertGetBoolCalled calls t.Error if FakeProvider.GetBool was not called

func (*FakeProvider) AssertGetBoolCalledN added in v0.3.0

func (f *FakeProvider) AssertGetBoolCalledN(t ProviderTestingT, n int)

AssertGetBoolCalledN calls t.Error if FakeProvider.GetBool was called less than n times

func (*FakeProvider) AssertGetBoolCalledOnce added in v0.3.0

func (f *FakeProvider) AssertGetBoolCalledOnce(t ProviderTestingT)

AssertGetBoolCalledOnce calls t.Error if FakeProvider.GetBool was not called exactly once

func (*FakeProvider) AssertGetBoolCalledOnceWith added in v0.3.0

func (_f29 *FakeProvider) AssertGetBoolCalledOnceWith(t ProviderTestingT, ident1 string)

AssertGetBoolCalledOnceWith calls t.Error if FakeProvider.GetBool was not called exactly once with the given values

func (*FakeProvider) AssertGetBoolCalledWith added in v0.3.0

func (_f27 *FakeProvider) AssertGetBoolCalledWith(t ProviderTestingT, ident1 string)

AssertGetBoolCalledWith calls t.Error if FakeProvider.GetBool was not called with the given values

func (*FakeProvider) AssertGetBoolNotCalled added in v0.3.0

func (f *FakeProvider) AssertGetBoolNotCalled(t ProviderTestingT)

AssertGetBoolNotCalled calls t.Error if FakeProvider.GetBool was called

func (*FakeProvider) AssertGetCalled added in v0.3.0

func (f *FakeProvider) AssertGetCalled(t ProviderTestingT)

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

func (*FakeProvider) AssertGetCalledN added in v0.3.0

func (f *FakeProvider) AssertGetCalledN(t ProviderTestingT, n int)

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

func (*FakeProvider) AssertGetCalledOnce added in v0.3.0

func (f *FakeProvider) AssertGetCalledOnce(t ProviderTestingT)

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

func (*FakeProvider) AssertGetCalledOnceWith added in v0.3.0

func (_f9 *FakeProvider) AssertGetCalledOnceWith(t ProviderTestingT, ident1 string)

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

func (*FakeProvider) AssertGetCalledWith added in v0.3.0

func (_f7 *FakeProvider) AssertGetCalledWith(t ProviderTestingT, ident1 string)

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

func (*FakeProvider) AssertGetIntCalled added in v0.3.0

func (f *FakeProvider) AssertGetIntCalled(t ProviderTestingT)

AssertGetIntCalled calls t.Error if FakeProvider.GetInt was not called

func (*FakeProvider) AssertGetIntCalledN added in v0.3.0

func (f *FakeProvider) AssertGetIntCalledN(t ProviderTestingT, n int)

AssertGetIntCalledN calls t.Error if FakeProvider.GetInt was called less than n times

func (*FakeProvider) AssertGetIntCalledOnce added in v0.3.0

func (f *FakeProvider) AssertGetIntCalledOnce(t ProviderTestingT)

AssertGetIntCalledOnce calls t.Error if FakeProvider.GetInt was not called exactly once

func (*FakeProvider) AssertGetIntCalledOnceWith added in v0.3.0

func (_f19 *FakeProvider) AssertGetIntCalledOnceWith(t ProviderTestingT, ident1 string)

AssertGetIntCalledOnceWith calls t.Error if FakeProvider.GetInt was not called exactly once with the given values

func (*FakeProvider) AssertGetIntCalledWith added in v0.3.0

func (_f17 *FakeProvider) AssertGetIntCalledWith(t ProviderTestingT, ident1 string)

AssertGetIntCalledWith calls t.Error if FakeProvider.GetInt was not called with the given values

func (*FakeProvider) AssertGetIntNotCalled added in v0.3.0

func (f *FakeProvider) AssertGetIntNotCalled(t ProviderTestingT)

AssertGetIntNotCalled calls t.Error if FakeProvider.GetInt was called

func (*FakeProvider) AssertGetNotCalled added in v0.3.0

func (f *FakeProvider) AssertGetNotCalled(t ProviderTestingT)

AssertGetNotCalled calls t.Error if FakeProvider.Get was called

func (*FakeProvider) AssertMonitorCalled added in v0.3.0

func (f *FakeProvider) AssertMonitorCalled(t ProviderTestingT)

AssertMonitorCalled calls t.Error if FakeProvider.Monitor was not called

func (*FakeProvider) AssertMonitorCalledN added in v0.3.0

func (f *FakeProvider) AssertMonitorCalledN(t ProviderTestingT, n int)

AssertMonitorCalledN calls t.Error if FakeProvider.Monitor was called less than n times

func (*FakeProvider) AssertMonitorCalledOnce added in v0.3.0

func (f *FakeProvider) AssertMonitorCalledOnce(t ProviderTestingT)

AssertMonitorCalledOnce calls t.Error if FakeProvider.Monitor was not called exactly once

func (*FakeProvider) AssertMonitorCalledOnceWith added in v0.3.0

func (_f35 *FakeProvider) AssertMonitorCalledOnceWith(t ProviderTestingT, ident1 string, ident2 chan<- Value)

AssertMonitorCalledOnceWith calls t.Error if FakeProvider.Monitor was not called exactly once with the given values

func (*FakeProvider) AssertMonitorCalledWith added in v0.3.0

func (_f33 *FakeProvider) AssertMonitorCalledWith(t ProviderTestingT, ident1 string, ident2 chan<- Value)

AssertMonitorCalledWith calls t.Error if FakeProvider.Monitor was not called with the given values

func (*FakeProvider) AssertMonitorNotCalled added in v0.3.0

func (f *FakeProvider) AssertMonitorNotCalled(t ProviderTestingT)

AssertMonitorNotCalled calls t.Error if FakeProvider.Monitor was called

func (*FakeProvider) Get added in v0.3.0

func (_f1 *FakeProvider) Get(ident1 string) (ident2 string, ident3 merry.Error)

func (*FakeProvider) GetBool added in v0.3.0

func (_f21 *FakeProvider) GetBool(ident1 string) (ident2 bool, ident3 merry.Error)

func (*FakeProvider) GetBoolCalled added in v0.3.0

func (f *FakeProvider) GetBoolCalled() bool

GetBoolCalled returns true if FakeProvider.GetBool was called

func (*FakeProvider) GetBoolCalledN added in v0.3.0

func (f *FakeProvider) GetBoolCalledN(n int) bool

GetBoolCalledN returns true if FakeProvider.GetBool was called at least n times

func (*FakeProvider) GetBoolCalledOnce added in v0.3.0

func (f *FakeProvider) GetBoolCalledOnce() bool

GetBoolCalledOnce returns true if FakeProvider.GetBool was called exactly once

func (*FakeProvider) GetBoolCalledOnceWith added in v0.3.0

func (_f28 *FakeProvider) GetBoolCalledOnceWith(ident1 string) bool

GetBoolCalledOnceWith returns true if FakeProvider.GetBool was called exactly once with the given values

func (*FakeProvider) GetBoolCalledWith added in v0.3.0

func (_f26 *FakeProvider) GetBoolCalledWith(ident1 string) (found bool)

GetBoolCalledWith returns true if FakeProvider.GetBool was called with the given values

func (*FakeProvider) GetBoolNotCalled added in v0.3.0

func (f *FakeProvider) GetBoolNotCalled() bool

GetBoolNotCalled returns true if FakeProvider.GetBool was not called

func (*FakeProvider) GetBoolResultsForCall added in v0.3.0

func (_f30 *FakeProvider) GetBoolResultsForCall(ident1 string) (ident2 bool, ident3 merry.Error, found bool)

GetBoolResultsForCall returns the result values for the first call to FakeProvider.GetBool with the given values

func (*FakeProvider) GetCalled added in v0.3.0

func (f *FakeProvider) GetCalled() bool

GetCalled returns true if FakeProvider.Get was called

func (*FakeProvider) GetCalledN added in v0.3.0

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

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

func (*FakeProvider) GetCalledOnce added in v0.3.0

func (f *FakeProvider) GetCalledOnce() bool

GetCalledOnce returns true if FakeProvider.Get was called exactly once

func (*FakeProvider) GetCalledOnceWith added in v0.3.0

func (_f8 *FakeProvider) GetCalledOnceWith(ident1 string) bool

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

func (*FakeProvider) GetCalledWith added in v0.3.0

func (_f6 *FakeProvider) GetCalledWith(ident1 string) (found bool)

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

func (*FakeProvider) GetInt added in v0.3.0

func (_f11 *FakeProvider) GetInt(ident1 string) (ident2 int, ident3 merry.Error)

func (*FakeProvider) GetIntCalled added in v0.3.0

func (f *FakeProvider) GetIntCalled() bool

GetIntCalled returns true if FakeProvider.GetInt was called

func (*FakeProvider) GetIntCalledN added in v0.3.0

func (f *FakeProvider) GetIntCalledN(n int) bool

GetIntCalledN returns true if FakeProvider.GetInt was called at least n times

func (*FakeProvider) GetIntCalledOnce added in v0.3.0

func (f *FakeProvider) GetIntCalledOnce() bool

GetIntCalledOnce returns true if FakeProvider.GetInt was called exactly once

func (*FakeProvider) GetIntCalledOnceWith added in v0.3.0

func (_f18 *FakeProvider) GetIntCalledOnceWith(ident1 string) bool

GetIntCalledOnceWith returns true if FakeProvider.GetInt was called exactly once with the given values

func (*FakeProvider) GetIntCalledWith added in v0.3.0

func (_f16 *FakeProvider) GetIntCalledWith(ident1 string) (found bool)

GetIntCalledWith returns true if FakeProvider.GetInt was called with the given values

func (*FakeProvider) GetIntNotCalled added in v0.3.0

func (f *FakeProvider) GetIntNotCalled() bool

GetIntNotCalled returns true if FakeProvider.GetInt was not called

func (*FakeProvider) GetIntResultsForCall added in v0.3.0

func (_f20 *FakeProvider) GetIntResultsForCall(ident1 string) (ident2 int, ident3 merry.Error, found bool)

GetIntResultsForCall returns the result values for the first call to FakeProvider.GetInt with the given values

func (*FakeProvider) GetNotCalled added in v0.3.0

func (f *FakeProvider) GetNotCalled() bool

GetNotCalled returns true if FakeProvider.Get was not called

func (*FakeProvider) GetResultsForCall added in v0.3.0

func (_f10 *FakeProvider) GetResultsForCall(ident1 string) (ident2 string, ident3 merry.Error, found bool)

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

func (*FakeProvider) Monitor added in v0.3.0

func (_f31 *FakeProvider) Monitor(ident1 string, ident2 chan<- Value)

func (*FakeProvider) MonitorCalled added in v0.3.0

func (f *FakeProvider) MonitorCalled() bool

MonitorCalled returns true if FakeProvider.Monitor was called

func (*FakeProvider) MonitorCalledN added in v0.3.0

func (f *FakeProvider) MonitorCalledN(n int) bool

MonitorCalledN returns true if FakeProvider.Monitor was called at least n times

func (*FakeProvider) MonitorCalledOnce added in v0.3.0

func (f *FakeProvider) MonitorCalledOnce() bool

MonitorCalledOnce returns true if FakeProvider.Monitor was called exactly once

func (*FakeProvider) MonitorCalledOnceWith added in v0.3.0

func (_f34 *FakeProvider) MonitorCalledOnceWith(ident1 string, ident2 chan<- Value) bool

MonitorCalledOnceWith returns true if FakeProvider.Monitor was called exactly once with the given values

func (*FakeProvider) MonitorCalledWith added in v0.3.0

func (_f32 *FakeProvider) MonitorCalledWith(ident1 string, ident2 chan<- Value) (found bool)

MonitorCalledWith returns true if FakeProvider.Monitor was called with the given values

func (*FakeProvider) MonitorNotCalled added in v0.3.0

func (f *FakeProvider) MonitorNotCalled() bool

MonitorNotCalled returns true if FakeProvider.Monitor was not called

func (*FakeProvider) Reset added in v0.3.0

func (f *FakeProvider) Reset()

func (*FakeProvider) SetGetBoolInvocation added in v0.3.1

func (_f23 *FakeProvider) SetGetBoolInvocation(calls_f24 []*ProviderGetBoolInvocation, fallback_f25 func() (bool, merry.Error))

SetGetBoolInvocation configures Provider.GetBool 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 (*FakeProvider) SetGetBoolStub added in v0.3.1

func (_f22 *FakeProvider) SetGetBoolStub(ident2 bool, ident3 merry.Error)

SetGetBoolStub configures Provider.GetBool to always return the given values

func (*FakeProvider) SetGetIntInvocation added in v0.3.1

func (_f13 *FakeProvider) SetGetIntInvocation(calls_f14 []*ProviderGetIntInvocation, fallback_f15 func() (int, merry.Error))

SetGetIntInvocation configures Provider.GetInt 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 (*FakeProvider) SetGetIntStub added in v0.3.1

func (_f12 *FakeProvider) SetGetIntStub(ident2 int, ident3 merry.Error)

SetGetIntStub configures Provider.GetInt to always return the given values

func (*FakeProvider) SetGetInvocation added in v0.3.1

func (_f3 *FakeProvider) SetGetInvocation(calls_f4 []*ProviderGetInvocation, fallback_f5 func() (string, merry.Error))

SetGetInvocation configures Provider.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 (*FakeProvider) SetGetStub added in v0.3.1

func (_f2 *FakeProvider) SetGetStub(ident2 string, ident3 merry.Error)

SetGetStub configures Provider.Get to always return the given values

type FakekvGetter added in v0.3.1

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 added in v0.3.1

func NewFakekvGetterDefaultError(t kvGetterTestingT) *FakekvGetter

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

func NewFakekvGetterDefaultFatal added in v0.3.1

func NewFakekvGetterDefaultFatal(t kvGetterTestingT) *FakekvGetter

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

func NewFakekvGetterDefaultPanic added in v0.3.1

func NewFakekvGetterDefaultPanic() *FakekvGetter

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

func (*FakekvGetter) AssertGetCalled added in v0.3.1

func (f *FakekvGetter) AssertGetCalled(t kvGetterTestingT)

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

func (*FakekvGetter) AssertGetCalledN added in v0.3.1

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

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

func (*FakekvGetter) AssertGetCalledOnce added in v0.3.1

func (f *FakekvGetter) AssertGetCalledOnce(t kvGetterTestingT)

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

func (*FakekvGetter) AssertGetCalledOnceWith added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

func (f *FakekvGetter) AssertGetNotCalled(t kvGetterTestingT)

AssertGetNotCalled calls t.Error if FakekvGetter.Get was called

func (*FakekvGetter) AssertListCalled added in v0.3.1

func (f *FakekvGetter) AssertListCalled(t kvGetterTestingT)

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

func (*FakekvGetter) AssertListCalledN added in v0.3.1

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

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

func (*FakekvGetter) AssertListCalledOnce added in v0.3.1

func (f *FakekvGetter) AssertListCalledOnce(t kvGetterTestingT)

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

func (*FakekvGetter) AssertListCalledOnceWith added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

func (f *FakekvGetter) AssertListNotCalled(t kvGetterTestingT)

AssertListNotCalled calls t.Error if FakekvGetter.List was called

func (*FakekvGetter) Get added in v0.3.1

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

func (*FakekvGetter) GetCalled added in v0.3.1

func (f *FakekvGetter) GetCalled() bool

GetCalled returns true if FakekvGetter.Get was called

func (*FakekvGetter) GetCalledN added in v0.3.1

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

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

func (*FakekvGetter) GetCalledOnce added in v0.3.1

func (f *FakekvGetter) GetCalledOnce() bool

GetCalledOnce returns true if FakekvGetter.Get was called exactly once

func (*FakekvGetter) GetCalledOnceWith added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

func (f *FakekvGetter) GetNotCalled() bool

GetNotCalled returns true if FakekvGetter.Get was not called

func (*FakekvGetter) GetResultsForCall added in v0.3.1

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 added in v0.3.1

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

func (*FakekvGetter) ListCalled added in v0.3.1

func (f *FakekvGetter) ListCalled() bool

ListCalled returns true if FakekvGetter.List was called

func (*FakekvGetter) ListCalledN added in v0.3.1

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

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

func (*FakekvGetter) ListCalledOnce added in v0.3.1

func (f *FakekvGetter) ListCalledOnce() bool

ListCalledOnce returns true if FakekvGetter.List was called exactly once

func (*FakekvGetter) ListCalledOnceWith added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

func (f *FakekvGetter) ListNotCalled() bool

ListNotCalled returns true if FakekvGetter.List was not called

func (*FakekvGetter) ListResultsForCall added in v0.3.1

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 added in v0.3.1

func (f *FakekvGetter) Reset()

func (*FakekvGetter) SetGetInvocation added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

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 added in v0.3.1

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

SetListStub configures kvGetter.List to always return the given values

type FakelogicalReader added in v0.4.2

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 added in v0.4.2

func NewFakelogicalReaderDefaultError(t logicalReaderTestingT) *FakelogicalReader

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

func NewFakelogicalReaderDefaultFatal added in v0.4.2

func NewFakelogicalReaderDefaultFatal(t logicalReaderTestingT) *FakelogicalReader

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

func NewFakelogicalReaderDefaultPanic added in v0.4.2

func NewFakelogicalReaderDefaultPanic() *FakelogicalReader

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

func (*FakelogicalReader) AssertReadCalled added in v0.4.2

func (f *FakelogicalReader) AssertReadCalled(t logicalReaderTestingT)

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

func (*FakelogicalReader) AssertReadCalledN added in v0.4.2

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

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

func (*FakelogicalReader) AssertReadCalledOnce added in v0.4.2

func (f *FakelogicalReader) AssertReadCalledOnce(t logicalReaderTestingT)

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

func (*FakelogicalReader) AssertReadCalledOnceWith added in v0.4.2

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 added in v0.4.2

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 added in v0.4.2

func (f *FakelogicalReader) AssertReadNotCalled(t logicalReaderTestingT)

AssertReadNotCalled calls t.Error if FakelogicalReader.Read was called

func (*FakelogicalReader) Read added in v0.4.2

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

func (*FakelogicalReader) ReadCalled added in v0.4.2

func (f *FakelogicalReader) ReadCalled() bool

ReadCalled returns true if FakelogicalReader.Read was called

func (*FakelogicalReader) ReadCalledN added in v0.4.2

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

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

func (*FakelogicalReader) ReadCalledOnce added in v0.4.2

func (f *FakelogicalReader) ReadCalledOnce() bool

ReadCalledOnce returns true if FakelogicalReader.Read was called exactly once

func (*FakelogicalReader) ReadCalledOnceWith added in v0.4.2

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

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

func (*FakelogicalReader) ReadCalledWith added in v0.4.2

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

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

func (*FakelogicalReader) ReadNotCalled added in v0.4.2

func (f *FakelogicalReader) ReadNotCalled() bool

ReadNotCalled returns true if FakelogicalReader.Read was not called

func (*FakelogicalReader) ReadResultsForCall added in v0.4.2

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 added in v0.4.2

func (f *FakelogicalReader) Reset()

func (*FakelogicalReader) SetReadInvocation added in v0.4.2

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 added in v0.4.2

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

SetReadStub configures logicalReader.Read to always return the given values

type Fakeselfer added in v0.3.1

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 added in v0.3.1

func NewFakeselferDefaultError(t selferTestingT) *Fakeselfer

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

func NewFakeselferDefaultFatal added in v0.3.1

func NewFakeselferDefaultFatal(t selferTestingT) *Fakeselfer

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

func NewFakeselferDefaultPanic added in v0.3.1

func NewFakeselferDefaultPanic() *Fakeselfer

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

func (*Fakeselfer) AssertSelfCalled added in v0.3.1

func (f *Fakeselfer) AssertSelfCalled(t selferTestingT)

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

func (*Fakeselfer) AssertSelfCalledN added in v0.3.1

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

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

func (*Fakeselfer) AssertSelfCalledOnce added in v0.3.1

func (f *Fakeselfer) AssertSelfCalledOnce(t selferTestingT)

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

func (*Fakeselfer) AssertSelfNotCalled added in v0.3.1

func (f *Fakeselfer) AssertSelfNotCalled(t selferTestingT)

AssertSelfNotCalled calls t.Error if Fakeselfer.Self was called

func (*Fakeselfer) Reset added in v0.3.1

func (f *Fakeselfer) Reset()

func (*Fakeselfer) Self added in v0.3.1

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

func (*Fakeselfer) SelfCalled added in v0.3.1

func (f *Fakeselfer) SelfCalled() bool

SelfCalled returns true if Fakeselfer.Self was called

func (*Fakeselfer) SelfCalledN added in v0.3.1

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

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

func (*Fakeselfer) SelfCalledOnce added in v0.3.1

func (f *Fakeselfer) SelfCalledOnce() bool

SelfCalledOnce returns true if Fakeselfer.Self was called exactly once

func (*Fakeselfer) SelfNotCalled added in v0.3.1

func (f *Fakeselfer) SelfNotCalled() bool

SelfNotCalled returns true if Fakeselfer.Self was not called

func (*Fakeselfer) SetSelfStub added in v0.3.1

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

SetSelfStub configures selfer.Self to always return the given values

type MultiProvider added in v0.4.0

type MultiProvider []Provider

func (MultiProvider) Get added in v0.4.0

func (p MultiProvider) Get(name string) (string, merry.Error)

func (MultiProvider) GetBool added in v0.4.0

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

func (MultiProvider) GetInt added in v0.4.0

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

func (MultiProvider) Monitor added in v0.4.0

func (p MultiProvider) Monitor(name string, v chan<- Value)

type Provider added in v0.3.0

type Provider interface {
	Get(string) (string, merry.Error)
	GetInt(string) (int, merry.Error)
	GetBool(string) (bool, merry.Error)
	Monitor(string, chan<- Value)
}

func NewSystem added in v0.3.0

func NewSystem() Provider

type ProviderGetBoolInvocation added in v0.3.0

type ProviderGetBoolInvocation struct {
	Parameters struct {
		Ident1 string
	}
	Results struct {
		Ident2 bool
		Ident3 merry.Error
	}
}

ProviderGetBoolInvocation represents a single call of FakeProvider.GetBool

func NewProviderGetBoolInvocation added in v0.3.1

func NewProviderGetBoolInvocation(ident1 string, ident2 bool, ident3 merry.Error) *ProviderGetBoolInvocation

NewProviderGetBoolInvocation creates a new instance of ProviderGetBoolInvocation

type ProviderGetIntInvocation added in v0.3.0

type ProviderGetIntInvocation struct {
	Parameters struct {
		Ident1 string
	}
	Results struct {
		Ident2 int
		Ident3 merry.Error
	}
}

ProviderGetIntInvocation represents a single call of FakeProvider.GetInt

func NewProviderGetIntInvocation added in v0.3.1

func NewProviderGetIntInvocation(ident1 string, ident2 int, ident3 merry.Error) *ProviderGetIntInvocation

NewProviderGetIntInvocation creates a new instance of ProviderGetIntInvocation

type ProviderGetInvocation added in v0.3.0

type ProviderGetInvocation struct {
	Parameters struct {
		Ident1 string
	}
	Results struct {
		Ident2 string
		Ident3 merry.Error
	}
}

ProviderGetInvocation represents a single call of FakeProvider.Get

func NewProviderGetInvocation added in v0.3.1

func NewProviderGetInvocation(ident1 string, ident2 string, ident3 merry.Error) *ProviderGetInvocation

NewProviderGetInvocation creates a new instance of ProviderGetInvocation

type ProviderMonitorInvocation added in v0.3.0

type ProviderMonitorInvocation struct {
	Parameters struct {
		Ident1 string
		Ident2 chan<- Value
	}
}

ProviderMonitorInvocation represents a single call of FakeProvider.Monitor

type ProviderTestingT added in v0.3.0

type ProviderTestingT interface {
	Error(...interface{})
	Errorf(string, ...interface{})
	Fatal(...interface{})
	Helper()
}

ProviderTestingT represents the methods of "testing".T used by charlatan Fakes. It avoids importing the testing package.

type Value added in v0.3.0

type Value struct {
	Name  string
	Value string
}

type VaultProvider added in v0.4.2

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

func NewVault added in v0.4.2

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

func (*VaultProvider) Get added in v0.4.2

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

func (*VaultProvider) GetBool added in v0.4.2

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

func (*VaultProvider) GetInt added in v0.4.2

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

func (*VaultProvider) Monitor added in v0.4.2

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

Jump to

Keyboard shortcuts

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