MCPcopy
hub / github.com/IBM/sarama / SyncProducer

Struct SyncProducer

mocks/sync_producer.go:14–27  ·  mocks/sync_producer.go::SyncProducer

SyncProducer implements sarama's SyncProducer interface for testing purposes. Before you can use it, you have to set expectations on the mock SyncProducer to tell it how to handle calls to SendMessage, so you can easily test success and failure scenarios.

Source from the content-addressed store, hash-verified

12// to tell it how to handle calls to SendMessage, so you can easily test success
13// and failure scenarios.
14type SyncProducer struct {
15 l sync.Mutex
16 t ErrorReporter
17 expectations []*producerExpectation
18 lastOffset int64
19
20 *TopicConfig
21 newPartitioner sarama.PartitionerConstructor
22 partitioners map[string]sarama.Partitioner
23
24 isTransactional bool
25 txnLock sync.Mutex
26 txnStatus sarama.ProducerTxnStatusFlag
27}
28
29// NewSyncProducer instantiates a new SyncProducer mock. The t argument should
30// be the *testing.T instance of your test method. An error will be written to it if

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected