env

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2018 License: BSD-3-Clause Imports: 8 Imported by: 1

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

func NewConsul(c *consul.Client) *consulProvider

Types

type ErrorHandler added in v0.3.0

type ErrorHandler func(error)

type FakeKVGetter added in v0.3.0

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.0

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.0

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.0

func NewFakeKVGetterDefaultPanic() *FakeKVGetter

NewFakeKVGetterDefaultPanic returns an instance of FakeKVGetter with all hooks configured to panic

func (*FakeKVGetter) AssertGetCalled added in v0.3.0

func (f *FakeKVGetter) AssertGetCalled(t KVGetterTestingT)

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

func (*FakeKVGetter) AssertGetCalledN added in v0.3.0

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.0

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.0

func (_f5 *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.0

func (_f3 *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.0

func (f *FakeKVGetter) AssertGetNotCalled(t KVGetterTestingT)

AssertGetNotCalled calls t.Error if FakeKVGetter.Get was called

func (*FakeKVGetter) AssertListCalled added in v0.3.0

func (f *FakeKVGetter) AssertListCalled(t KVGetterTestingT)

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

func (*FakeKVGetter) AssertListCalledN added in v0.3.0

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.0

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.0

func (_f11 *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.0

func (_f9 *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.0

func (f *FakeKVGetter) AssertListNotCalled(t KVGetterTestingT)

AssertListNotCalled calls t.Error if FakeKVGetter.List was called

func (*FakeKVGetter) Get added in v0.3.0

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

func (*FakeKVGetter) GetCalled added in v0.3.0

func (f *FakeKVGetter) GetCalled() bool

GetCalled returns true if FakeKVGetter.Get was called

func (*FakeKVGetter) GetCalledN added in v0.3.0

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.0

func (f *FakeKVGetter) GetCalledOnce() bool

GetCalledOnce returns true if FakeKVGetter.Get was called exactly once

func (*FakeKVGetter) GetCalledOnceWith added in v0.3.0

func (_f4 *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.0

func (_f2 *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.0

func (f *FakeKVGetter) GetNotCalled() bool

GetNotCalled returns true if FakeKVGetter.Get was not called

func (*FakeKVGetter) GetResultsForCall added in v0.3.0

func (_f6 *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.0

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

func (*FakeKVGetter) ListCalled added in v0.3.0

func (f *FakeKVGetter) ListCalled() bool

ListCalled returns true if FakeKVGetter.List was called

func (*FakeKVGetter) ListCalledN added in v0.3.0

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.0

func (f *FakeKVGetter) ListCalledOnce() bool

ListCalledOnce returns true if FakeKVGetter.List was called exactly once

func (*FakeKVGetter) ListCalledOnceWith added in v0.3.0

func (_f10 *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.0

func (_f8 *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.0

func (f *FakeKVGetter) ListNotCalled() bool

ListNotCalled returns true if FakeKVGetter.List was not called

func (*FakeKVGetter) ListResultsForCall added in v0.3.0

func (_f12 *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.0

func (f *FakeKVGetter) Reset()

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)
	HealthcheckHook func(context.Context) merry.Error

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

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 (_f17 *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 (_f15 *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 (_f5 *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 (_f3 *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 (_f11 *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 (_f9 *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) AssertHealthcheckCalled added in v0.3.0

func (f *FakeProvider) AssertHealthcheckCalled(t ProviderTestingT)

AssertHealthcheckCalled calls t.Error if FakeProvider.Healthcheck was not called

func (*FakeProvider) AssertHealthcheckCalledN added in v0.3.0

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

AssertHealthcheckCalledN calls t.Error if FakeProvider.Healthcheck was called less than n times

func (*FakeProvider) AssertHealthcheckCalledOnce added in v0.3.0

func (f *FakeProvider) AssertHealthcheckCalledOnce(t ProviderTestingT)

AssertHealthcheckCalledOnce calls t.Error if FakeProvider.Healthcheck was not called exactly once

func (*FakeProvider) AssertHealthcheckCalledOnceWith added in v0.3.0

func (_f28 *FakeProvider) AssertHealthcheckCalledOnceWith(t ProviderTestingT, ident1 context.Context)

AssertHealthcheckCalledOnceWith calls t.Error if FakeProvider.Healthcheck was not called exactly once with the given values

func (*FakeProvider) AssertHealthcheckCalledWith added in v0.3.0

func (_f26 *FakeProvider) AssertHealthcheckCalledWith(t ProviderTestingT, ident1 context.Context)

AssertHealthcheckCalledWith calls t.Error if FakeProvider.Healthcheck was not called with the given values

func (*FakeProvider) AssertHealthcheckNotCalled added in v0.3.0

func (f *FakeProvider) AssertHealthcheckNotCalled(t ProviderTestingT)

AssertHealthcheckNotCalled calls t.Error if FakeProvider.Healthcheck 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 (_f23 *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 (_f21 *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 (_f13 *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 (_f16 *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 (_f14 *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 (_f18 *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 (_f4 *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 (_f2 *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 (_f7 *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 (_f10 *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 (_f8 *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 (_f12 *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 (_f6 *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) Healthcheck added in v0.3.0

func (_f24 *FakeProvider) Healthcheck(ident1 context.Context) (ident2 merry.Error)

func (*FakeProvider) HealthcheckCalled added in v0.3.0

func (f *FakeProvider) HealthcheckCalled() bool

HealthcheckCalled returns true if FakeProvider.Healthcheck was called

func (*FakeProvider) HealthcheckCalledN added in v0.3.0

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

HealthcheckCalledN returns true if FakeProvider.Healthcheck was called at least n times

func (*FakeProvider) HealthcheckCalledOnce added in v0.3.0

func (f *FakeProvider) HealthcheckCalledOnce() bool

HealthcheckCalledOnce returns true if FakeProvider.Healthcheck was called exactly once

func (*FakeProvider) HealthcheckCalledOnceWith added in v0.3.0

func (_f27 *FakeProvider) HealthcheckCalledOnceWith(ident1 context.Context) bool

HealthcheckCalledOnceWith returns true if FakeProvider.Healthcheck was called exactly once with the given values

func (*FakeProvider) HealthcheckCalledWith added in v0.3.0

func (_f25 *FakeProvider) HealthcheckCalledWith(ident1 context.Context) (found bool)

HealthcheckCalledWith returns true if FakeProvider.Healthcheck was called with the given values

func (*FakeProvider) HealthcheckNotCalled added in v0.3.0

func (f *FakeProvider) HealthcheckNotCalled() bool

HealthcheckNotCalled returns true if FakeProvider.Healthcheck was not called

func (*FakeProvider) HealthcheckResultsForCall added in v0.3.0

func (_f29 *FakeProvider) HealthcheckResultsForCall(ident1 context.Context) (ident2 merry.Error, found bool)

HealthcheckResultsForCall returns the result values for the first call to FakeProvider.Healthcheck with the given values

func (*FakeProvider) Monitor added in v0.3.0

func (_f19 *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 (_f22 *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 (_f20 *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()

type FakeSelfer added in v0.3.0

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.0

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.0

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.0

func NewFakeSelferDefaultPanic() *FakeSelfer

NewFakeSelferDefaultPanic returns an instance of FakeSelfer with all hooks configured to panic

func (*FakeSelfer) AssertSelfCalled added in v0.3.0

func (f *FakeSelfer) AssertSelfCalled(t SelferTestingT)

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

func (*FakeSelfer) AssertSelfCalledN added in v0.3.0

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.0

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.0

func (f *FakeSelfer) AssertSelfNotCalled(t SelferTestingT)

AssertSelfNotCalled calls t.Error if FakeSelfer.Self was called

func (*FakeSelfer) Reset added in v0.3.0

func (f *FakeSelfer) Reset()

func (*FakeSelfer) Self added in v0.3.0

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

func (*FakeSelfer) SelfCalled added in v0.3.0

func (f *FakeSelfer) SelfCalled() bool

SelfCalled returns true if FakeSelfer.Self was called

func (*FakeSelfer) SelfCalledN added in v0.3.0

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.0

func (f *FakeSelfer) SelfCalledOnce() bool

SelfCalledOnce returns true if FakeSelfer.Self was called exactly once

func (*FakeSelfer) SelfNotCalled added in v0.3.0

func (f *FakeSelfer) SelfNotCalled() bool

SelfNotCalled returns true if FakeSelfer.Self was not called

type KVGetter added in v0.3.0

type KVGetterGetInvocation added in v0.3.0

type KVGetterGetInvocation struct {
	Parameters struct {
		Ident1 string
		Ident2 *consul.QueryOptions
	}
	Results struct {
		Ident3 *consul.KVPair
		Ident4 *consul.QueryMeta
		Ident5 error
	}
}

KVGetterGetInvocation represents a single call of FakeKVGetter.Get

type KVGetterListInvocation added in v0.3.0

type KVGetterListInvocation struct {
	Parameters struct {
		Ident1 string
		Ident2 *consul.QueryOptions
	}
	Results struct {
		Ident3 consul.KVPairs
		Ident4 *consul.QueryMeta
		Ident5 error
	}
}

KVGetterListInvocation represents a single call of FakeKVGetter.List

type KVGetterTestingT added in v0.3.0

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

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

type MemberStatus added in v0.3.0

type MemberStatus int
const (
	StatusNone MemberStatus = iota
	StatusAlive
	StatusLeaving
	StatusLeft
	StatusFailed
)

func (MemberStatus) String added in v0.3.0

func (s MemberStatus) String() string

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)
	Healthcheck(context.Context) merry.Error
}

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

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

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

type ProviderHealthcheckInvocation added in v0.3.0

type ProviderHealthcheckInvocation struct {
	Parameters struct {
		Ident1 context.Context
	}
	Results struct {
		Ident2 merry.Error
	}
}

ProviderHealthcheckInvocation represents a single call of FakeProvider.Healthcheck

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

type Selfer interface {
	Self() (map[string]map[string]interface{}, error)
}

type SelferSelfInvocation added in v0.3.0

type SelferSelfInvocation struct {
	Results struct {
		Ident1 map[string]map[string]interface{}
		Ident2 error
	}
}

SelferSelfInvocation represents a single call of FakeSelfer.Self

type SelferTestingT added in v0.3.0

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

SelferTestingT 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
}

Jump to

Keyboard shortcuts

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