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

Function TestSyncProducerInvalidConfiguration

mocks/sync_producer_test.go:358–373  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

356}
357
358func TestSyncProducerInvalidConfiguration(t *testing.T) {
359 trm := newTestReporterMock()
360 config := NewTestConfig()
361 config.Version = sarama.V0_11_0_2
362 config.ClientID = "not a valid producer ID"
363 mp := NewSyncProducer(trm, config)
364 if err := mp.Close(); err != nil {
365 t.Error(err)
366 }
367
368 if len(trm.errors) != 1 {
369 t.Error("Expected to report a single error")
370 } else if !strings.Contains(trm.errors[0], `ClientID value "not a valid producer ID" is not valid for Kafka versions before 1.0.0`) {
371 t.Errorf("Unexpected error: %s", trm.errors[0])
372 }
373}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected