Documentation ¶
Index ¶
- type Alert
- type AlertMock
- func (mock *AlertMock) Get(name string) (*alert.Alert, error)
- func (mock *AlertMock) GetCalls() []struct{ ... }
- func (mock *AlertMock) Index(levels []alert.Level) (alert.Alerts, error)
- func (mock *AlertMock) IndexCalls() []struct{ ... }
- func (mock *AlertMock) Update(name string, level alert.Level) (*alert.Alert, bool, error)
- func (mock *AlertMock) UpdateCalls() []struct{ ... }
- type CoreStorage
- type CoreStorageMock
- func (mock *CoreStorageMock) Alert() Alert
- func (mock *CoreStorageMock) AlertCalls() []struct{}
- func (mock *CoreStorageMock) KV() KV
- func (mock *CoreStorageMock) KVCalls() []struct{}
- func (mock *CoreStorageMock) Name() string
- func (mock *CoreStorageMock) NameCalls() []struct{}
- func (mock *CoreStorageMock) Stop() error
- func (mock *CoreStorageMock) StopCalls() []struct{}
- type KV
- type KVMock
- func (mock *KVMock) All() (map[string]string, error)
- func (mock *KVMock) AllCalls() []struct{}
- func (mock *KVMock) Delete(s string) error
- func (mock *KVMock) DeleteCalls() []struct{ ... }
- func (mock *KVMock) Get(s string) (string, error)
- func (mock *KVMock) GetCalls() []struct{ ... }
- func (mock *KVMock) Put(s1 string, s2 string) error
- func (mock *KVMock) PutCalls() []struct{ ... }
- func (mock *KVMock) Upsert(s1 string, s2 string) error
- func (mock *KVMock) UpsertCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert interface { // Update exists alert or create new Update(name string, level alert.Level) (*alert.Alert, bool, error) Index(levels []alert.Level) (alert.Alerts, error) Get(name string) (*alert.Alert, error) }
Alert is an interface for Alert storage
type AlertMock ¶
type AlertMock struct { // GetFunc mocks the Get method. GetFunc func(name string) (*alert.Alert, error) // IndexFunc mocks the Index method. IndexFunc func(levels []alert.Level) (alert.Alerts, error) // UpdateFunc mocks the Update method. UpdateFunc func(name string, level alert.Level) (*alert.Alert, bool, error) // contains filtered or unexported fields }
AlertMock is a mock implementation of Alert.
func TestSomethingThatUsesAlert(t *testing.T) { // make and configure a mocked Alert mockedAlert := &AlertMock{ GetFunc: func(name string) (*alert.Alert, error) { panic("mock out the Get method") }, IndexFunc: func(levels []alert.Level) (alert.Alerts, error) { panic("mock out the Index method") }, UpdateFunc: func(name string, level alert.Level) (*alert.Alert, bool, error) { panic("mock out the Update method") }, } // use mockedAlert in code that requires Alert // and then make assertions. }
func (*AlertMock) GetCalls ¶ added in v0.9.3
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedAlert.GetCalls())
func (*AlertMock) IndexCalls ¶ added in v0.9.3
IndexCalls gets all the calls that were made to Index. Check the length with:
len(mockedAlert.IndexCalls())
type CoreStorage ¶
CoreStorage is an interface for the CoreStorage
type CoreStorageMock ¶ added in v0.9.3
type CoreStorageMock struct { // AlertFunc mocks the Alert method. AlertFunc func() Alert // KVFunc mocks the KV method. KVFunc func() KV // NameFunc mocks the Name method. NameFunc func() string // StopFunc mocks the Stop method. StopFunc func() error // contains filtered or unexported fields }
CoreStorageMock is a mock implementation of CoreStorage.
func TestSomethingThatUsesCoreStorage(t *testing.T) { // make and configure a mocked CoreStorage mockedCoreStorage := &CoreStorageMock{ AlertFunc: func() Alert { panic("mock out the Alert method") }, KVFunc: func() KV { panic("mock out the KV method") }, NameFunc: func() string { panic("mock out the Name method") }, StopFunc: func() error { panic("mock out the Stop method") }, } // use mockedCoreStorage in code that requires CoreStorage // and then make assertions. }
func (*CoreStorageMock) Alert ¶ added in v0.9.3
func (mock *CoreStorageMock) Alert() Alert
Alert calls AlertFunc.
func (*CoreStorageMock) AlertCalls ¶ added in v0.9.3
func (mock *CoreStorageMock) AlertCalls() []struct { }
AlertCalls gets all the calls that were made to Alert. Check the length with:
len(mockedCoreStorage.AlertCalls())
func (*CoreStorageMock) KVCalls ¶ added in v0.9.3
func (mock *CoreStorageMock) KVCalls() []struct { }
KVCalls gets all the calls that were made to KV. Check the length with:
len(mockedCoreStorage.KVCalls())
func (*CoreStorageMock) Name ¶ added in v0.9.3
func (mock *CoreStorageMock) Name() string
Name calls NameFunc.
func (*CoreStorageMock) NameCalls ¶ added in v0.9.3
func (mock *CoreStorageMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedCoreStorage.NameCalls())
func (*CoreStorageMock) Stop ¶ added in v0.9.3
func (mock *CoreStorageMock) Stop() error
Stop calls StopFunc.
func (*CoreStorageMock) StopCalls ¶ added in v0.9.3
func (mock *CoreStorageMock) StopCalls() []struct { }
StopCalls gets all the calls that were made to Stop. Check the length with:
len(mockedCoreStorage.StopCalls())
type KV ¶
type KV interface { Put(string, string) error Get(string) (string, error) Upsert(string, string) error Delete(string) error All() (map[string]string, error) }
KV is an interface for KV storage
type KVMock ¶
type KVMock struct { // AllFunc mocks the All method. AllFunc func() (map[string]string, error) // DeleteFunc mocks the Delete method. DeleteFunc func(s string) error // GetFunc mocks the Get method. GetFunc func(s string) (string, error) // PutFunc mocks the Put method. PutFunc func(s1 string, s2 string) error // UpsertFunc mocks the Upsert method. UpsertFunc func(s1 string, s2 string) error // contains filtered or unexported fields }
KVMock is a mock implementation of KV.
func TestSomethingThatUsesKV(t *testing.T) { // make and configure a mocked KV mockedKV := &KVMock{ AllFunc: func() (map[string]string, error) { panic("mock out the All method") }, DeleteFunc: func(s string) error { panic("mock out the Delete method") }, GetFunc: func(s string) (string, error) { panic("mock out the Get method") }, PutFunc: func(s1 string, s2 string) error { panic("mock out the Put method") }, UpsertFunc: func(s1 string, s2 string) error { panic("mock out the Upsert method") }, } // use mockedKV in code that requires KV // and then make assertions. }
func (*KVMock) AllCalls ¶ added in v0.9.3
func (mock *KVMock) AllCalls() []struct { }
AllCalls gets all the calls that were made to All. Check the length with:
len(mockedKV.AllCalls())
func (*KVMock) DeleteCalls ¶ added in v0.9.3
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedKV.DeleteCalls())
func (*KVMock) GetCalls ¶ added in v0.9.3
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedKV.GetCalls())
func (*KVMock) PutCalls ¶ added in v0.9.3
PutCalls gets all the calls that were made to Put. Check the length with:
len(mockedKV.PutCalls())
func (*KVMock) UpsertCalls ¶ added in v0.9.3
UpsertCalls gets all the calls that were made to Upsert. Check the length with:
len(mockedKV.UpsertCalls())