Documentation ¶
Index ¶
- type AsyncProducerMock
- func (mock *AsyncProducerMock) AsyncClose()
- func (mock *AsyncProducerMock) AsyncCloseCalls() []struct{}
- func (mock *AsyncProducerMock) Close() error
- func (mock *AsyncProducerMock) CloseCalls() []struct{}
- func (mock *AsyncProducerMock) Errors() <-chan *sarama.ProducerError
- func (mock *AsyncProducerMock) ErrorsCalls() []struct{}
- func (mock *AsyncProducerMock) Input() chan<- *sarama.ProducerMessage
- func (mock *AsyncProducerMock) InputCalls() []struct{}
- func (mock *AsyncProducerMock) Successes() <-chan *sarama.ProducerMessage
- func (mock *AsyncProducerMock) SuccessesCalls() []struct{}
- type SaramaClusterConsumerMock
- func (mock *SaramaClusterConsumerMock) Close() error
- func (mock *SaramaClusterConsumerMock) CloseCalls() []struct{}
- func (mock *SaramaClusterConsumerMock) CommitOffsets() error
- func (mock *SaramaClusterConsumerMock) CommitOffsetsCalls() []struct{}
- func (mock *SaramaClusterConsumerMock) Errors() <-chan error
- func (mock *SaramaClusterConsumerMock) ErrorsCalls() []struct{}
- func (mock *SaramaClusterConsumerMock) MarkOffset(msg *sarama.ConsumerMessage, metadata string)
- func (mock *SaramaClusterConsumerMock) MarkOffsetCalls() []struct{ ... }
- func (mock *SaramaClusterConsumerMock) Messages() <-chan *sarama.ConsumerMessage
- func (mock *SaramaClusterConsumerMock) MessagesCalls() []struct{}
- func (mock *SaramaClusterConsumerMock) Notifications() <-chan *cluster.Notification
- func (mock *SaramaClusterConsumerMock) NotificationsCalls() []struct{}
- type SaramaClusterMock
- type SaramaMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncProducerMock ¶
type AsyncProducerMock struct { // AsyncCloseFunc mocks the AsyncClose method. AsyncCloseFunc func() // CloseFunc mocks the Close method. CloseFunc func() error // ErrorsFunc mocks the Errors method. ErrorsFunc func() <-chan *sarama.ProducerError // InputFunc mocks the Input method. InputFunc func() chan<- *sarama.ProducerMessage // SuccessesFunc mocks the Successes method. SuccessesFunc func() <-chan *sarama.ProducerMessage // contains filtered or unexported fields }
AsyncProducerMock is a mock implementation of kafka.AsyncProducer.
func TestSomethingThatUsesAsyncProducer(t *testing.T) { // make and configure a mocked kafka.AsyncProducer mockedAsyncProducer := &AsyncProducerMock{ AsyncCloseFunc: func() { panic("mock out the AsyncClose method") }, CloseFunc: func() error { panic("mock out the Close method") }, ErrorsFunc: func() <-chan *sarama.ProducerError { panic("mock out the Errors method") }, InputFunc: func() chan<- *sarama.ProducerMessage { panic("mock out the Input method") }, SuccessesFunc: func() <-chan *sarama.ProducerMessage { panic("mock out the Successes method") }, } // use mockedAsyncProducer in code that requires kafka.AsyncProducer // and then make assertions. }
func (*AsyncProducerMock) AsyncClose ¶
func (mock *AsyncProducerMock) AsyncClose()
AsyncClose calls AsyncCloseFunc.
func (*AsyncProducerMock) AsyncCloseCalls ¶
func (mock *AsyncProducerMock) AsyncCloseCalls() []struct { }
AsyncCloseCalls gets all the calls that were made to AsyncClose. Check the length with:
len(mockedAsyncProducer.AsyncCloseCalls())
func (*AsyncProducerMock) Close ¶
func (mock *AsyncProducerMock) Close() error
Close calls CloseFunc.
func (*AsyncProducerMock) CloseCalls ¶
func (mock *AsyncProducerMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedAsyncProducer.CloseCalls())
func (*AsyncProducerMock) Errors ¶
func (mock *AsyncProducerMock) Errors() <-chan *sarama.ProducerError
Errors calls ErrorsFunc.
func (*AsyncProducerMock) ErrorsCalls ¶
func (mock *AsyncProducerMock) ErrorsCalls() []struct { }
ErrorsCalls gets all the calls that were made to Errors. Check the length with:
len(mockedAsyncProducer.ErrorsCalls())
func (*AsyncProducerMock) Input ¶
func (mock *AsyncProducerMock) Input() chan<- *sarama.ProducerMessage
Input calls InputFunc.
func (*AsyncProducerMock) InputCalls ¶
func (mock *AsyncProducerMock) InputCalls() []struct { }
InputCalls gets all the calls that were made to Input. Check the length with:
len(mockedAsyncProducer.InputCalls())
func (*AsyncProducerMock) Successes ¶
func (mock *AsyncProducerMock) Successes() <-chan *sarama.ProducerMessage
Successes calls SuccessesFunc.
func (*AsyncProducerMock) SuccessesCalls ¶
func (mock *AsyncProducerMock) SuccessesCalls() []struct { }
SuccessesCalls gets all the calls that were made to Successes. Check the length with:
len(mockedAsyncProducer.SuccessesCalls())
type SaramaClusterConsumerMock ¶
type SaramaClusterConsumerMock struct { // CloseFunc mocks the Close method. CloseFunc func() error // CommitOffsetsFunc mocks the CommitOffsets method. CommitOffsetsFunc func() error // ErrorsFunc mocks the Errors method. ErrorsFunc func() <-chan error // MarkOffsetFunc mocks the MarkOffset method. MarkOffsetFunc func(msg *sarama.ConsumerMessage, metadata string) // MessagesFunc mocks the Messages method. MessagesFunc func() <-chan *sarama.ConsumerMessage // NotificationsFunc mocks the Notifications method. NotificationsFunc func() <-chan *cluster.Notification // contains filtered or unexported fields }
SaramaClusterConsumerMock is a mock implementation of kafka.SaramaClusterConsumer.
func TestSomethingThatUsesSaramaClusterConsumer(t *testing.T) { // make and configure a mocked kafka.SaramaClusterConsumer mockedSaramaClusterConsumer := &SaramaClusterConsumerMock{ CloseFunc: func() error { panic("mock out the Close method") }, CommitOffsetsFunc: func() error { panic("mock out the CommitOffsets method") }, ErrorsFunc: func() <-chan error { panic("mock out the Errors method") }, MarkOffsetFunc: func(msg *sarama.ConsumerMessage, metadata string) { panic("mock out the MarkOffset method") }, MessagesFunc: func() <-chan *sarama.ConsumerMessage { panic("mock out the Messages method") }, NotificationsFunc: func() <-chan *cluster.Notification { panic("mock out the Notifications method") }, } // use mockedSaramaClusterConsumer in code that requires kafka.SaramaClusterConsumer // and then make assertions. }
func (*SaramaClusterConsumerMock) Close ¶
func (mock *SaramaClusterConsumerMock) Close() error
Close calls CloseFunc.
func (*SaramaClusterConsumerMock) CloseCalls ¶
func (mock *SaramaClusterConsumerMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedSaramaClusterConsumer.CloseCalls())
func (*SaramaClusterConsumerMock) CommitOffsets ¶
func (mock *SaramaClusterConsumerMock) CommitOffsets() error
CommitOffsets calls CommitOffsetsFunc.
func (*SaramaClusterConsumerMock) CommitOffsetsCalls ¶
func (mock *SaramaClusterConsumerMock) CommitOffsetsCalls() []struct { }
CommitOffsetsCalls gets all the calls that were made to CommitOffsets. Check the length with:
len(mockedSaramaClusterConsumer.CommitOffsetsCalls())
func (*SaramaClusterConsumerMock) Errors ¶
func (mock *SaramaClusterConsumerMock) Errors() <-chan error
Errors calls ErrorsFunc.
func (*SaramaClusterConsumerMock) ErrorsCalls ¶
func (mock *SaramaClusterConsumerMock) ErrorsCalls() []struct { }
ErrorsCalls gets all the calls that were made to Errors. Check the length with:
len(mockedSaramaClusterConsumer.ErrorsCalls())
func (*SaramaClusterConsumerMock) MarkOffset ¶
func (mock *SaramaClusterConsumerMock) MarkOffset(msg *sarama.ConsumerMessage, metadata string)
MarkOffset calls MarkOffsetFunc.
func (*SaramaClusterConsumerMock) MarkOffsetCalls ¶
func (mock *SaramaClusterConsumerMock) MarkOffsetCalls() []struct { Msg *sarama.ConsumerMessage Metadata string }
MarkOffsetCalls gets all the calls that were made to MarkOffset. Check the length with:
len(mockedSaramaClusterConsumer.MarkOffsetCalls())
func (*SaramaClusterConsumerMock) Messages ¶
func (mock *SaramaClusterConsumerMock) Messages() <-chan *sarama.ConsumerMessage
Messages calls MessagesFunc.
func (*SaramaClusterConsumerMock) MessagesCalls ¶
func (mock *SaramaClusterConsumerMock) MessagesCalls() []struct { }
MessagesCalls gets all the calls that were made to Messages. Check the length with:
len(mockedSaramaClusterConsumer.MessagesCalls())
func (*SaramaClusterConsumerMock) Notifications ¶
func (mock *SaramaClusterConsumerMock) Notifications() <-chan *cluster.Notification
Notifications calls NotificationsFunc.
func (*SaramaClusterConsumerMock) NotificationsCalls ¶
func (mock *SaramaClusterConsumerMock) NotificationsCalls() []struct { }
NotificationsCalls gets all the calls that were made to Notifications. Check the length with:
len(mockedSaramaClusterConsumer.NotificationsCalls())
type SaramaClusterMock ¶
type SaramaClusterMock struct { // NewConsumerFunc mocks the NewConsumer method. NewConsumerFunc func(addrs []string, groupID string, topics []string, config *cluster.Config) (kafka.SaramaClusterConsumer, error) // contains filtered or unexported fields }
SaramaClusterMock is a mock implementation of kafka.SaramaCluster.
func TestSomethingThatUsesSaramaCluster(t *testing.T) { // make and configure a mocked kafka.SaramaCluster mockedSaramaCluster := &SaramaClusterMock{ NewConsumerFunc: func(addrs []string, groupID string, topics []string, config *cluster.Config) (kafka.SaramaClusterConsumer, error) { panic("mock out the NewConsumer method") }, } // use mockedSaramaCluster in code that requires kafka.SaramaCluster // and then make assertions. }
func (*SaramaClusterMock) NewConsumer ¶
func (mock *SaramaClusterMock) NewConsumer(addrs []string, groupID string, topics []string, config *cluster.Config) (kafka.SaramaClusterConsumer, error)
NewConsumer calls NewConsumerFunc.
func (*SaramaClusterMock) NewConsumerCalls ¶
func (mock *SaramaClusterMock) NewConsumerCalls() []struct { Addrs []string GroupID string Topics []string Config *cluster.Config }
NewConsumerCalls gets all the calls that were made to NewConsumer. Check the length with:
len(mockedSaramaCluster.NewConsumerCalls())
type SaramaMock ¶
type SaramaMock struct { // NewAsyncProducerFunc mocks the NewAsyncProducer method. NewAsyncProducerFunc func(addrs []string, conf *sarama.Config) (sarama.AsyncProducer, error) // contains filtered or unexported fields }
SaramaMock is a mock implementation of kafka.Sarama.
func TestSomethingThatUsesSarama(t *testing.T) { // make and configure a mocked kafka.Sarama mockedSarama := &SaramaMock{ NewAsyncProducerFunc: func(addrs []string, conf *sarama.Config) (sarama.AsyncProducer, error) { panic("mock out the NewAsyncProducer method") }, } // use mockedSarama in code that requires kafka.Sarama // and then make assertions. }
func (*SaramaMock) NewAsyncProducer ¶
func (mock *SaramaMock) NewAsyncProducer(addrs []string, conf *sarama.Config) (sarama.AsyncProducer, error)
NewAsyncProducer calls NewAsyncProducerFunc.
func (*SaramaMock) NewAsyncProducerCalls ¶
func (mock *SaramaMock) NewAsyncProducerCalls() []struct { Addrs []string Conf *sarama.Config }
NewAsyncProducerCalls gets all the calls that were made to NewAsyncProducer. Check the length with:
len(mockedSarama.NewAsyncProducerCalls())