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

Function TestProducerWithInvalidConfiguration

mocks/async_producer_test.go:253–267  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251func (brokePartitioner) RequiresConsistency() bool { return false }
252
253func TestProducerWithInvalidConfiguration(t *testing.T) {
254 trm := newTestReporterMock()
255 config := NewTestConfig()
256 config.Version = sarama.V0_11_0_2
257 config.ClientID = "not a valid producer ID"
258 mp := NewAsyncProducer(trm, config)
259 if err := mp.Close(); err != nil {
260 t.Error(err)
261 }
262 if len(trm.errors) != 1 {
263 t.Error("Expected to report a single error")
264 } else if !strings.Contains(trm.errors[0], `ClientID value "not a valid producer ID" is not valid for Kafka versions before 1.0.0`) {
265 t.Errorf("Unexpected error: %s", trm.errors[0])
266 }
267}

Callers

nothing calls this directly

Calls 6

CloseMethod · 0.95
newTestReporterMockFunction · 0.85
NewTestConfigFunction · 0.70
NewAsyncProducerFunction · 0.70
ErrorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected