mock

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SaramaAsyncProducerMock

type SaramaAsyncProducerMock 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
}

SaramaAsyncProducerMock is a mock implementation of kafka.SaramaAsyncProducer.

    func TestSomethingThatUsesSaramaAsyncProducer(t *testing.T) {

        // make and configure a mocked kafka.SaramaAsyncProducer
        mockedSaramaAsyncProducer := &SaramaAsyncProducerMock{
            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 mockedSaramaAsyncProducer in code that requires kafka.SaramaAsyncProducer
        // and then make assertions.

    }

func (*SaramaAsyncProducerMock) AsyncClose

func (mock *SaramaAsyncProducerMock) AsyncClose()

AsyncClose calls AsyncCloseFunc.

func (*SaramaAsyncProducerMock) AsyncCloseCalls

func (mock *SaramaAsyncProducerMock) AsyncCloseCalls() []struct {
}

AsyncCloseCalls gets all the calls that were made to AsyncClose. Check the length with:

len(mockedSaramaAsyncProducer.AsyncCloseCalls())

func (*SaramaAsyncProducerMock) Close

func (mock *SaramaAsyncProducerMock) Close() error

Close calls CloseFunc.

func (*SaramaAsyncProducerMock) CloseCalls

func (mock *SaramaAsyncProducerMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedSaramaAsyncProducer.CloseCalls())

func (*SaramaAsyncProducerMock) Errors

func (mock *SaramaAsyncProducerMock) Errors() <-chan *sarama.ProducerError

Errors calls ErrorsFunc.

func (*SaramaAsyncProducerMock) ErrorsCalls

func (mock *SaramaAsyncProducerMock) ErrorsCalls() []struct {
}

ErrorsCalls gets all the calls that were made to Errors. Check the length with:

len(mockedSaramaAsyncProducer.ErrorsCalls())

func (*SaramaAsyncProducerMock) Input

func (mock *SaramaAsyncProducerMock) Input() chan<- *sarama.ProducerMessage

Input calls InputFunc.

func (*SaramaAsyncProducerMock) InputCalls

func (mock *SaramaAsyncProducerMock) InputCalls() []struct {
}

InputCalls gets all the calls that were made to Input. Check the length with:

len(mockedSaramaAsyncProducer.InputCalls())

func (*SaramaAsyncProducerMock) Successes

func (mock *SaramaAsyncProducerMock) Successes() <-chan *sarama.ProducerMessage

Successes calls SuccessesFunc.

func (*SaramaAsyncProducerMock) SuccessesCalls

func (mock *SaramaAsyncProducerMock) SuccessesCalls() []struct {
}

SuccessesCalls gets all the calls that were made to Successes. Check the length with:

len(mockedSaramaAsyncProducer.SuccessesCalls())

type SaramaConsumerGroupClaimMock

type SaramaConsumerGroupClaimMock struct {
	// HighWaterMarkOffsetFunc mocks the HighWaterMarkOffset method.
	HighWaterMarkOffsetFunc func() int64

	// InitialOffsetFunc mocks the InitialOffset method.
	InitialOffsetFunc func() int64

	// MessagesFunc mocks the Messages method.
	MessagesFunc func() <-chan *sarama.ConsumerMessage

	// PartitionFunc mocks the Partition method.
	PartitionFunc func() int32

	// TopicFunc mocks the Topic method.
	TopicFunc func() string
	// contains filtered or unexported fields
}

SaramaConsumerGroupClaimMock is a mock implementation of kafka.SaramaConsumerGroupClaim.

    func TestSomethingThatUsesSaramaConsumerGroupClaim(t *testing.T) {

        // make and configure a mocked kafka.SaramaConsumerGroupClaim
        mockedSaramaConsumerGroupClaim := &SaramaConsumerGroupClaimMock{
            HighWaterMarkOffsetFunc: func() int64 {
	               panic("mock out the HighWaterMarkOffset method")
            },
            InitialOffsetFunc: func() int64 {
	               panic("mock out the InitialOffset method")
            },
            MessagesFunc: func() <-chan *sarama.ConsumerMessage {
	               panic("mock out the Messages method")
            },
            PartitionFunc: func() int32 {
	               panic("mock out the Partition method")
            },
            TopicFunc: func() string {
	               panic("mock out the Topic method")
            },
        }

        // use mockedSaramaConsumerGroupClaim in code that requires kafka.SaramaConsumerGroupClaim
        // and then make assertions.

    }

func (*SaramaConsumerGroupClaimMock) HighWaterMarkOffset

func (mock *SaramaConsumerGroupClaimMock) HighWaterMarkOffset() int64

HighWaterMarkOffset calls HighWaterMarkOffsetFunc.

func (*SaramaConsumerGroupClaimMock) HighWaterMarkOffsetCalls

func (mock *SaramaConsumerGroupClaimMock) HighWaterMarkOffsetCalls() []struct {
}

HighWaterMarkOffsetCalls gets all the calls that were made to HighWaterMarkOffset. Check the length with:

len(mockedSaramaConsumerGroupClaim.HighWaterMarkOffsetCalls())

func (*SaramaConsumerGroupClaimMock) InitialOffset

func (mock *SaramaConsumerGroupClaimMock) InitialOffset() int64

InitialOffset calls InitialOffsetFunc.

func (*SaramaConsumerGroupClaimMock) InitialOffsetCalls

func (mock *SaramaConsumerGroupClaimMock) InitialOffsetCalls() []struct {
}

InitialOffsetCalls gets all the calls that were made to InitialOffset. Check the length with:

len(mockedSaramaConsumerGroupClaim.InitialOffsetCalls())

func (*SaramaConsumerGroupClaimMock) Messages

func (mock *SaramaConsumerGroupClaimMock) Messages() <-chan *sarama.ConsumerMessage

Messages calls MessagesFunc.

func (*SaramaConsumerGroupClaimMock) MessagesCalls

func (mock *SaramaConsumerGroupClaimMock) MessagesCalls() []struct {
}

MessagesCalls gets all the calls that were made to Messages. Check the length with:

len(mockedSaramaConsumerGroupClaim.MessagesCalls())

func (*SaramaConsumerGroupClaimMock) Partition

func (mock *SaramaConsumerGroupClaimMock) Partition() int32

Partition calls PartitionFunc.

func (*SaramaConsumerGroupClaimMock) PartitionCalls

func (mock *SaramaConsumerGroupClaimMock) PartitionCalls() []struct {
}

PartitionCalls gets all the calls that were made to Partition. Check the length with:

len(mockedSaramaConsumerGroupClaim.PartitionCalls())

func (*SaramaConsumerGroupClaimMock) Topic

func (mock *SaramaConsumerGroupClaimMock) Topic() string

Topic calls TopicFunc.

func (*SaramaConsumerGroupClaimMock) TopicCalls

func (mock *SaramaConsumerGroupClaimMock) TopicCalls() []struct {
}

TopicCalls gets all the calls that were made to Topic. Check the length with:

len(mockedSaramaConsumerGroupClaim.TopicCalls())

type SaramaConsumerGroupMock

type SaramaConsumerGroupMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func() error

	// ConsumeFunc mocks the Consume method.
	ConsumeFunc func(ctx context.Context, topics []string, handler sarama.ConsumerGroupHandler) error

	// ErrorsFunc mocks the Errors method.
	ErrorsFunc func() <-chan error
	// contains filtered or unexported fields
}

SaramaConsumerGroupMock is a mock implementation of kafka.SaramaConsumerGroup.

    func TestSomethingThatUsesSaramaConsumerGroup(t *testing.T) {

        // make and configure a mocked kafka.SaramaConsumerGroup
        mockedSaramaConsumerGroup := &SaramaConsumerGroupMock{
            CloseFunc: func() error {
	               panic("mock out the Close method")
            },
            ConsumeFunc: func(ctx context.Context, topics []string, handler sarama.ConsumerGroupHandler) error {
	               panic("mock out the Consume method")
            },
            ErrorsFunc: func() <-chan error {
	               panic("mock out the Errors method")
            },
        }

        // use mockedSaramaConsumerGroup in code that requires kafka.SaramaConsumerGroup
        // and then make assertions.

    }

func (*SaramaConsumerGroupMock) Close

func (mock *SaramaConsumerGroupMock) Close() error

Close calls CloseFunc.

func (*SaramaConsumerGroupMock) CloseCalls

func (mock *SaramaConsumerGroupMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedSaramaConsumerGroup.CloseCalls())

func (*SaramaConsumerGroupMock) Consume

func (mock *SaramaConsumerGroupMock) Consume(ctx context.Context, topics []string, handler sarama.ConsumerGroupHandler) error

Consume calls ConsumeFunc.

func (*SaramaConsumerGroupMock) ConsumeCalls

func (mock *SaramaConsumerGroupMock) ConsumeCalls() []struct {
	Ctx     context.Context
	Topics  []string
	Handler sarama.ConsumerGroupHandler
}

ConsumeCalls gets all the calls that were made to Consume. Check the length with:

len(mockedSaramaConsumerGroup.ConsumeCalls())

func (*SaramaConsumerGroupMock) Errors

func (mock *SaramaConsumerGroupMock) Errors() <-chan error

Errors calls ErrorsFunc.

func (*SaramaConsumerGroupMock) ErrorsCalls

func (mock *SaramaConsumerGroupMock) ErrorsCalls() []struct {
}

ErrorsCalls gets all the calls that were made to Errors. Check the length with:

len(mockedSaramaConsumerGroup.ErrorsCalls())

type SaramaConsumerGroupSessionMock

type SaramaConsumerGroupSessionMock struct {
	// ClaimsFunc mocks the Claims method.
	ClaimsFunc func() map[string][]int32

	// CommitFunc mocks the Commit method.
	CommitFunc func()

	// ContextFunc mocks the Context method.
	ContextFunc func() context.Context

	// GenerationIDFunc mocks the GenerationID method.
	GenerationIDFunc func() int32

	// MarkMessageFunc mocks the MarkMessage method.
	MarkMessageFunc func(msg *sarama.ConsumerMessage, metadata string)

	// MarkOffsetFunc mocks the MarkOffset method.
	MarkOffsetFunc func(topic string, partition int32, offset int64, metadata string)

	// MemberIDFunc mocks the MemberID method.
	MemberIDFunc func() string

	// ResetOffsetFunc mocks the ResetOffset method.
	ResetOffsetFunc func(topic string, partition int32, offset int64, metadata string)
	// contains filtered or unexported fields
}

SaramaConsumerGroupSessionMock is a mock implementation of kafka.SaramaConsumerGroupSession.

    func TestSomethingThatUsesSaramaConsumerGroupSession(t *testing.T) {

        // make and configure a mocked kafka.SaramaConsumerGroupSession
        mockedSaramaConsumerGroupSession := &SaramaConsumerGroupSessionMock{
            ClaimsFunc: func() map[string][]int32 {
	               panic("mock out the Claims method")
            },
            CommitFunc: func()  {
	               panic("mock out the Commit method")
            },
            ContextFunc: func() context.Context {
	               panic("mock out the Context method")
            },
            GenerationIDFunc: func() int32 {
	               panic("mock out the GenerationID method")
            },
            MarkMessageFunc: func(msg *sarama.ConsumerMessage, metadata string)  {
	               panic("mock out the MarkMessage method")
            },
            MarkOffsetFunc: func(topic string, partition int32, offset int64, metadata string)  {
	               panic("mock out the MarkOffset method")
            },
            MemberIDFunc: func() string {
	               panic("mock out the MemberID method")
            },
            ResetOffsetFunc: func(topic string, partition int32, offset int64, metadata string)  {
	               panic("mock out the ResetOffset method")
            },
        }

        // use mockedSaramaConsumerGroupSession in code that requires kafka.SaramaConsumerGroupSession
        // and then make assertions.

    }

func (*SaramaConsumerGroupSessionMock) Claims

func (mock *SaramaConsumerGroupSessionMock) Claims() map[string][]int32

Claims calls ClaimsFunc.

func (*SaramaConsumerGroupSessionMock) ClaimsCalls

func (mock *SaramaConsumerGroupSessionMock) ClaimsCalls() []struct {
}

ClaimsCalls gets all the calls that were made to Claims. Check the length with:

len(mockedSaramaConsumerGroupSession.ClaimsCalls())

func (*SaramaConsumerGroupSessionMock) Commit

func (mock *SaramaConsumerGroupSessionMock) Commit()

Commit calls CommitFunc.

func (*SaramaConsumerGroupSessionMock) CommitCalls

func (mock *SaramaConsumerGroupSessionMock) CommitCalls() []struct {
}

CommitCalls gets all the calls that were made to Commit. Check the length with:

len(mockedSaramaConsumerGroupSession.CommitCalls())

func (*SaramaConsumerGroupSessionMock) Context

Context calls ContextFunc.

func (*SaramaConsumerGroupSessionMock) ContextCalls

func (mock *SaramaConsumerGroupSessionMock) ContextCalls() []struct {
}

ContextCalls gets all the calls that were made to Context. Check the length with:

len(mockedSaramaConsumerGroupSession.ContextCalls())

func (*SaramaConsumerGroupSessionMock) GenerationID

func (mock *SaramaConsumerGroupSessionMock) GenerationID() int32

GenerationID calls GenerationIDFunc.

func (*SaramaConsumerGroupSessionMock) GenerationIDCalls

func (mock *SaramaConsumerGroupSessionMock) GenerationIDCalls() []struct {
}

GenerationIDCalls gets all the calls that were made to GenerationID. Check the length with:

len(mockedSaramaConsumerGroupSession.GenerationIDCalls())

func (*SaramaConsumerGroupSessionMock) MarkMessage

func (mock *SaramaConsumerGroupSessionMock) MarkMessage(msg *sarama.ConsumerMessage, metadata string)

MarkMessage calls MarkMessageFunc.

func (*SaramaConsumerGroupSessionMock) MarkMessageCalls

func (mock *SaramaConsumerGroupSessionMock) MarkMessageCalls() []struct {
	Msg      *sarama.ConsumerMessage
	Metadata string
}

MarkMessageCalls gets all the calls that were made to MarkMessage. Check the length with:

len(mockedSaramaConsumerGroupSession.MarkMessageCalls())

func (*SaramaConsumerGroupSessionMock) MarkOffset

func (mock *SaramaConsumerGroupSessionMock) MarkOffset(topic string, partition int32, offset int64, metadata string)

MarkOffset calls MarkOffsetFunc.

func (*SaramaConsumerGroupSessionMock) MarkOffsetCalls

func (mock *SaramaConsumerGroupSessionMock) MarkOffsetCalls() []struct {
	Topic     string
	Partition int32
	Offset    int64
	Metadata  string
}

MarkOffsetCalls gets all the calls that were made to MarkOffset. Check the length with:

len(mockedSaramaConsumerGroupSession.MarkOffsetCalls())

func (*SaramaConsumerGroupSessionMock) MemberID

func (mock *SaramaConsumerGroupSessionMock) MemberID() string

MemberID calls MemberIDFunc.

func (*SaramaConsumerGroupSessionMock) MemberIDCalls

func (mock *SaramaConsumerGroupSessionMock) MemberIDCalls() []struct {
}

MemberIDCalls gets all the calls that were made to MemberID. Check the length with:

len(mockedSaramaConsumerGroupSession.MemberIDCalls())

func (*SaramaConsumerGroupSessionMock) ResetOffset

func (mock *SaramaConsumerGroupSessionMock) ResetOffset(topic string, partition int32, offset int64, metadata string)

ResetOffset calls ResetOffsetFunc.

func (*SaramaConsumerGroupSessionMock) ResetOffsetCalls

func (mock *SaramaConsumerGroupSessionMock) ResetOffsetCalls() []struct {
	Topic     string
	Partition int32
	Offset    int64
	Metadata  string
}

ResetOffsetCalls gets all the calls that were made to ResetOffset. Check the length with:

len(mockedSaramaConsumerGroupSession.ResetOffsetCalls())

Jump to

Keyboard shortcuts

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