Documentation
¶
Index ¶
- type Hasher
- type HasherMock
- type InvalidConfigError
- type NewSenderer
- type NewSendererMock
- type Sender
- type SenderMock
- func (mock *SenderMock) Config() interface{}
- func (mock *SenderMock) ConfigCalls() []struct{}
- func (mock *SenderMock) Name() string
- func (mock *SenderMock) NameCalls() []struct{}
- func (mock *SenderMock) Plugin() string
- func (mock *SenderMock) PluginCalls() []struct{}
- func (mock *SenderMock) Send(e event.Event)
- func (mock *SenderMock) SendCalls() []struct{ ... }
- func (mock *SenderMock) StopSending(ctx context.Context)
- func (mock *SenderMock) StopSendingCalls() []struct{ ... }
- func (mock *SenderMock) Unwrap() Sender
- func (mock *SenderMock) UnwrapCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HasherMock ¶
type HasherMock struct {
// SenderHashFunc mocks the SenderHash method.
SenderHashFunc func(config interface{}) (string, error)
// contains filtered or unexported fields
}
HasherMock is a mock implementation of Hasher.
func TestSomethingThatUsesHasher(t *testing.T) {
// make and configure a mocked Hasher
mockedHasher := &HasherMock{
SenderHashFunc: func(config interface{}) (string, error) {
panic("mock out the SenderHash method")
},
}
// use mockedHasher in code that requires Hasher
// and then make assertions.
}
func (*HasherMock) SenderHash ¶
func (mock *HasherMock) SenderHash(config interface{}) (string, error)
SenderHash calls SenderHashFunc.
func (*HasherMock) SenderHashCalls ¶
func (mock *HasherMock) SenderHashCalls() []struct { Config interface{} }
SenderHashCalls gets all the calls that were made to SenderHash. Check the length with:
len(mockedHasher.SenderHashCalls())
type InvalidConfigError ¶
type InvalidConfigError struct {
Err error
}
func (*InvalidConfigError) Error ¶
func (e *InvalidConfigError) Error() string
func (*InvalidConfigError) Unwrap ¶
func (e *InvalidConfigError) Unwrap() error
type NewSenderer ¶
type NewSendererMock ¶
type NewSendererMock struct {
// NewSenderFunc mocks the NewSender method.
NewSenderFunc func(config interface{}) (Sender, error)
// SenderHashFunc mocks the SenderHash method.
SenderHashFunc func(config interface{}) (string, error)
// contains filtered or unexported fields
}
NewSendererMock is a mock implementation of NewSenderer.
func TestSomethingThatUsesNewSenderer(t *testing.T) {
// make and configure a mocked NewSenderer
mockedNewSenderer := &NewSendererMock{
NewSenderFunc: func(config interface{}) (Sender, error) {
panic("mock out the NewSender method")
},
SenderHashFunc: func(config interface{}) (string, error) {
panic("mock out the SenderHash method")
},
}
// use mockedNewSenderer in code that requires NewSenderer
// and then make assertions.
}
func (*NewSendererMock) NewSender ¶
func (mock *NewSendererMock) NewSender(config interface{}) (Sender, error)
NewSender calls NewSenderFunc.
func (*NewSendererMock) NewSenderCalls ¶
func (mock *NewSendererMock) NewSenderCalls() []struct { Config interface{} }
NewSenderCalls gets all the calls that were made to NewSender. Check the length with:
len(mockedNewSenderer.NewSenderCalls())
func (*NewSendererMock) SenderHash ¶
func (mock *NewSendererMock) SenderHash(config interface{}) (string, error)
SenderHash calls SenderHashFunc.
func (*NewSendererMock) SenderHashCalls ¶
func (mock *NewSendererMock) SenderHashCalls() []struct { Config interface{} }
SenderHashCalls gets all the calls that were made to SenderHash. Check the length with:
len(mockedNewSenderer.SenderHashCalls())
type Sender ¶
type Sender interface {
// Send consumes and event and sends it to the target
Send(e event.Event)
// Unwrap
Unwrap() Sender
// StopSending will stop any long running maintenance threads in the sender plugin.
// Often this function does nothing.
StopSending(ctx context.Context)
//
Config() interface{}
Name() string
Plugin() string
}
or Outputter[√] or Producer[x] or Publisher[√]
type SenderMock ¶
type SenderMock struct {
// ConfigFunc mocks the Config method.
ConfigFunc func() interface{}
// NameFunc mocks the Name method.
NameFunc func() string
// PluginFunc mocks the Plugin method.
PluginFunc func() string
// SendFunc mocks the Send method.
SendFunc func(e event.Event)
// StopSendingFunc mocks the StopSending method.
StopSendingFunc func(ctx context.Context)
// UnwrapFunc mocks the Unwrap method.
UnwrapFunc func() Sender
// contains filtered or unexported fields
}
SenderMock is a mock implementation of Sender.
func TestSomethingThatUsesSender(t *testing.T) {
// make and configure a mocked Sender
mockedSender := &SenderMock{
ConfigFunc: func() interface{} {
panic("mock out the Config method")
},
NameFunc: func() string {
panic("mock out the Name method")
},
PluginFunc: func() string {
panic("mock out the Plugin method")
},
SendFunc: func(e event.Event) {
panic("mock out the Send method")
},
StopSendingFunc: func(ctx context.Context) {
panic("mock out the StopSending method")
},
UnwrapFunc: func() Sender {
panic("mock out the Unwrap method")
},
}
// use mockedSender in code that requires Sender
// and then make assertions.
}
func (*SenderMock) Config ¶ added in v0.2.1
func (mock *SenderMock) Config() interface{}
Config calls ConfigFunc.
func (*SenderMock) ConfigCalls ¶ added in v0.2.1
func (mock *SenderMock) ConfigCalls() []struct { }
ConfigCalls gets all the calls that were made to Config. Check the length with:
len(mockedSender.ConfigCalls())
func (*SenderMock) Name ¶ added in v0.2.1
func (mock *SenderMock) Name() string
Name calls NameFunc.
func (*SenderMock) NameCalls ¶ added in v0.2.1
func (mock *SenderMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedSender.NameCalls())
func (*SenderMock) Plugin ¶ added in v0.2.1
func (mock *SenderMock) Plugin() string
Plugin calls PluginFunc.
func (*SenderMock) PluginCalls ¶ added in v0.2.1
func (mock *SenderMock) PluginCalls() []struct { }
PluginCalls gets all the calls that were made to Plugin. Check the length with:
len(mockedSender.PluginCalls())
func (*SenderMock) SendCalls ¶
func (mock *SenderMock) SendCalls() []struct { E event.Event }
SendCalls gets all the calls that were made to Send. Check the length with:
len(mockedSender.SendCalls())
func (*SenderMock) StopSending ¶
func (mock *SenderMock) StopSending(ctx context.Context)
StopSending calls StopSendingFunc.
func (*SenderMock) StopSendingCalls ¶
func (mock *SenderMock) StopSendingCalls() []struct { Ctx context.Context }
StopSendingCalls gets all the calls that were made to StopSending. Check the length with:
len(mockedSender.StopSendingCalls())
func (*SenderMock) UnwrapCalls ¶
func (mock *SenderMock) UnwrapCalls() []struct { }
UnwrapCalls gets all the calls that were made to Unwrap. Check the length with:
len(mockedSender.UnwrapCalls())