Documentation
¶
Overview ¶
Please check out the _example filter for a pattern for creating new filters.
Index ¶
- type Chain
- type Chainer
- type ChainerMock
- func (mock *ChainerMock) Add(f Filterer) error
- func (mock *ChainerMock) AddCalls() []struct{ ... }
- func (mock *ChainerMock) Filter(e event.Event) []event.Event
- func (mock *ChainerMock) FilterCalls() []struct{ ... }
- func (mock *ChainerMock) Filterers() []Filterer
- func (mock *ChainerMock) FilterersCalls() []struct{}
- type Filterer
- type FiltererMock
- type Hasher
- type HasherMock
- type InvalidArgumentError
- type InvalidConfigError
- type NewFilterer
- type NewFiltererMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chainer ¶
type Chainer interface {
Filterer
// Add will add a filterer to the chain
Add(f Filterer) error
Filterers() []Filterer
}
Chainer TODO: https://github.com/xmidt-org/ears/issues/74
type ChainerMock ¶
type ChainerMock struct {
// AddFunc mocks the Add method.
AddFunc func(f Filterer) error
// FilterFunc mocks the Filter method.
FilterFunc func(e event.Event) []event.Event
// FilterersFunc mocks the Filterers method.
FilterersFunc func() []Filterer
// contains filtered or unexported fields
}
ChainerMock is a mock implementation of Chainer.
func TestSomethingThatUsesChainer(t *testing.T) {
// make and configure a mocked Chainer
mockedChainer := &ChainerMock{
AddFunc: func(f Filterer) error {
panic("mock out the Add method")
},
FilterFunc: func(e event.Event) []event.Event {
panic("mock out the Filter method")
},
FilterersFunc: func() []Filterer {
panic("mock out the Filterers method")
},
}
// use mockedChainer in code that requires Chainer
// and then make assertions.
}
func (*ChainerMock) AddCalls ¶
func (mock *ChainerMock) AddCalls() []struct { F Filterer }
AddCalls gets all the calls that were made to Add. Check the length with:
len(mockedChainer.AddCalls())
func (*ChainerMock) Filter ¶
func (mock *ChainerMock) Filter(e event.Event) []event.Event
Filter calls FilterFunc.
func (*ChainerMock) FilterCalls ¶
func (mock *ChainerMock) FilterCalls() []struct { E event.Event }
FilterCalls gets all the calls that were made to Filter. Check the length with:
len(mockedChainer.FilterCalls())
func (*ChainerMock) Filterers ¶
func (mock *ChainerMock) Filterers() []Filterer
Filterers calls FilterersFunc.
func (*ChainerMock) FilterersCalls ¶
func (mock *ChainerMock) FilterersCalls() []struct { }
FilterersCalls gets all the calls that were made to Filterers. Check the length with:
len(mockedChainer.FilterersCalls())
type Filterer ¶
Filterer defines the interface that a filterer must implement TODO: https://github.com/xmidt-org/ears/issues/74
type FiltererMock ¶
type FiltererMock struct {
// FilterFunc mocks the Filter method.
FilterFunc func(e event.Event) []event.Event
// contains filtered or unexported fields
}
FiltererMock is a mock implementation of Filterer.
func TestSomethingThatUsesFilterer(t *testing.T) {
// make and configure a mocked Filterer
mockedFilterer := &FiltererMock{
FilterFunc: func(e event.Event) []event.Event {
panic("mock out the Filter method")
},
}
// use mockedFilterer in code that requires Filterer
// and then make assertions.
}
func (*FiltererMock) Filter ¶
func (mock *FiltererMock) Filter(e event.Event) []event.Event
Filter calls FilterFunc.
func (*FiltererMock) FilterCalls ¶
func (mock *FiltererMock) FilterCalls() []struct { E event.Event }
FilterCalls gets all the calls that were made to Filter. Check the length with:
len(mockedFilterer.FilterCalls())
type Hasher ¶
type Hasher interface {
// FiltererHash calculates the hash of a filterer based on the
// given configuration
FiltererHash(config interface{}) (string, error)
}
Hasher defines the hashing interface that a receiver needs to implement
type HasherMock ¶
type HasherMock struct {
// FiltererHashFunc mocks the FiltererHash method.
FiltererHashFunc 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{
FiltererHashFunc: func(config interface{}) (string, error) {
panic("mock out the FiltererHash method")
},
}
// use mockedHasher in code that requires Hasher
// and then make assertions.
}
func (*HasherMock) FiltererHash ¶
func (mock *HasherMock) FiltererHash(config interface{}) (string, error)
FiltererHash calls FiltererHashFunc.
func (*HasherMock) FiltererHashCalls ¶
func (mock *HasherMock) FiltererHashCalls() []struct { Config interface{} }
FiltererHashCalls gets all the calls that were made to FiltererHash. Check the length with:
len(mockedHasher.FiltererHashCalls())
type InvalidArgumentError ¶
type InvalidArgumentError struct {
Err error
}
func (*InvalidArgumentError) Error ¶
func (e *InvalidArgumentError) Error() string
func (*InvalidArgumentError) Unwrap ¶
func (e *InvalidArgumentError) Unwrap() error
type InvalidConfigError ¶
type InvalidConfigError struct {
Err error
}
InvalidConfigError is returned when a configuration parameter results in a plugin error
func (*InvalidConfigError) Error ¶
func (e *InvalidConfigError) Error() string
func (*InvalidConfigError) Unwrap ¶
func (e *InvalidConfigError) Unwrap() error
type NewFilterer ¶
type NewFilterer interface {
Hasher
// NewFilterer returns an object that implements the Filterer interface
NewFilterer(config interface{}) (Filterer, error)
}
NewFilterer defines the interface on how to to create a new filterer
type NewFiltererMock ¶
type NewFiltererMock struct {
// FiltererHashFunc mocks the FiltererHash method.
FiltererHashFunc func(config interface{}) (string, error)
// NewFiltererFunc mocks the NewFilterer method.
NewFiltererFunc func(config interface{}) (Filterer, error)
// contains filtered or unexported fields
}
NewFiltererMock is a mock implementation of NewFilterer.
func TestSomethingThatUsesNewFilterer(t *testing.T) {
// make and configure a mocked NewFilterer
mockedNewFilterer := &NewFiltererMock{
FiltererHashFunc: func(config interface{}) (string, error) {
panic("mock out the FiltererHash method")
},
NewFiltererFunc: func(config interface{}) (Filterer, error) {
panic("mock out the NewFilterer method")
},
}
// use mockedNewFilterer in code that requires NewFilterer
// and then make assertions.
}
func (*NewFiltererMock) FiltererHash ¶
func (mock *NewFiltererMock) FiltererHash(config interface{}) (string, error)
FiltererHash calls FiltererHashFunc.
func (*NewFiltererMock) FiltererHashCalls ¶
func (mock *NewFiltererMock) FiltererHashCalls() []struct { Config interface{} }
FiltererHashCalls gets all the calls that were made to FiltererHash. Check the length with:
len(mockedNewFilterer.FiltererHashCalls())
func (*NewFiltererMock) NewFilterer ¶
func (mock *NewFiltererMock) NewFilterer(config interface{}) (Filterer, error)
NewFilterer calls NewFiltererFunc.
func (*NewFiltererMock) NewFiltererCalls ¶
func (mock *NewFiltererMock) NewFiltererCalls() []struct { Config interface{} }
NewFiltererCalls gets all the calls that were made to NewFilterer. Check the length with:
len(mockedNewFilterer.NewFiltererCalls())