Documentation
¶
Overview ¶
Package kafkaproducer is a generated GoMock package.
Package kafkaproducer contains helpers for running Kafka in tests and checking outbound messages.
Index ¶
- type Harness
- func (harness *Harness) AwaitOutbound(ctx context.Context) (probe.CheckResult, error)
- func (harness *Harness) CleanupBroker(_ context.Context) error
- func (harness *Harness) PlanOutbound(ctx context.Context, expectation probe.OutboundExpectation) error
- func (harness *Harness) PublishJSON(ctx context.Context, topic string, key *string, headers map[string]string, ...) error
- func (harness *Harness) PublishRaw(ctx context.Context, message PublishMessage) error
- func (harness *Harness) ResolveTopic(baseTopic string) string
- func (harness *Harness) VerifyOutbound(ctx context.Context) (probe.CheckResult, error)
- type MockmessageReader
- type MockmessageReaderMockRecorder
- type MockmessageWriter
- type MockmessageWriterMockRecorder
- type PublishMessage
- type Suite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Harness ¶
type Harness struct {
// contains filtered or unexported fields
}
Harness implements outbound checks and publishing via Kafka for a single case.
func NewHarness ¶
NewHarness creates a case-level helper with producer and consumer for outbound scenarios.
func (*Harness) AwaitOutbound ¶
AwaitOutbound performs intermediate checks on published messages.
func (*Harness) CleanupBroker ¶
CleanupBroker releases the consumer/producer harness resources.
func (*Harness) PlanOutbound ¶
func (harness *Harness) PlanOutbound(ctx context.Context, expectation probe.OutboundExpectation) error
PlanOutbound saves the wait and activates the reader with a "from now" boundary.
func (*Harness) PublishJSON ¶
func (harness *Harness) PublishJSON( ctx context.Context, topic string, key *string, headers map[string]string, payload any, ) error
PublishJSON serializes the payload and sends the message to Kafka.
func (*Harness) PublishRaw ¶
func (harness *Harness) PublishRaw(ctx context.Context, message PublishMessage) error
PublishRaw sends the already serialized payload to Kafka.
func (*Harness) ResolveTopic ¶
ResolveTopic adds a namespace prefix to the base topic to isolate cases.
func (*Harness) VerifyOutbound ¶
VerifyOutbound performs final verification of published messages.
type MockmessageReader ¶
type MockmessageReader struct {
// contains filtered or unexported fields
}
MockmessageReader is a mock of messageReader interface.
func NewMockmessageReader ¶
func NewMockmessageReader(ctrl *gomock.Controller) *MockmessageReader
NewMockmessageReader creates a new mock instance.
func (*MockmessageReader) Close ¶
func (m *MockmessageReader) Close() error
Close mocks base method.
func (*MockmessageReader) EXPECT ¶
func (m *MockmessageReader) EXPECT() *MockmessageReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockmessageReader) FetchMessage ¶
func (m *MockmessageReader) FetchMessage(ctx context.Context) (harnessMessage, error)
FetchMessage mocks base method.
type MockmessageReaderMockRecorder ¶
type MockmessageReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockmessageReaderMockRecorder is the mock recorder for MockmessageReader.
func (*MockmessageReaderMockRecorder) Close ¶
func (mr *MockmessageReaderMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockmessageReaderMockRecorder) FetchMessage ¶
func (mr *MockmessageReaderMockRecorder) FetchMessage(ctx any) *gomock.Call
FetchMessage indicates an expected call of FetchMessage.
type MockmessageWriter ¶
type MockmessageWriter struct {
// contains filtered or unexported fields
}
MockmessageWriter is a mock of messageWriter interface.
func NewMockmessageWriter ¶
func NewMockmessageWriter(ctrl *gomock.Controller) *MockmessageWriter
NewMockmessageWriter creates a new mock instance.
func (*MockmessageWriter) Close ¶
func (m *MockmessageWriter) Close() error
Close mocks base method.
func (*MockmessageWriter) EXPECT ¶
func (m *MockmessageWriter) EXPECT() *MockmessageWriterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockmessageWriter) WriteMessages ¶
func (m *MockmessageWriter) WriteMessages(ctx context.Context, msgs ...harnessMessage) error
WriteMessages mocks base method.
type MockmessageWriterMockRecorder ¶
type MockmessageWriterMockRecorder struct {
// contains filtered or unexported fields
}
MockmessageWriterMockRecorder is the mock recorder for MockmessageWriter.
func (*MockmessageWriterMockRecorder) Close ¶
func (mr *MockmessageWriterMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockmessageWriterMockRecorder) WriteMessages ¶
func (mr *MockmessageWriterMockRecorder) WriteMessages(ctx any, msgs ...any) *gomock.Call
WriteMessages indicates an expected call of WriteMessages.
type PublishMessage ¶
PublishMessage describes the message data to be sent to Kafka.
type Suite ¶
type Suite struct {
// contains filtered or unexported fields
}
Suite manages the lifecycle of a Kafka container at the test suite level.
func StartSuite ¶
StartSuite picks up a Kafka container and returns a suite helper.