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

Function TestConsumerInvalidConfiguration

mocks/consumer_test.go:407–422  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

405}
406
407func TestConsumerInvalidConfiguration(t *testing.T) {
408 trm := newTestReporterMock()
409 config := NewTestConfig()
410 config.Version = sarama.V0_11_0_2
411 config.ClientID = "not a valid consumer ID"
412 consumer := NewConsumer(trm, config)
413 if err := consumer.Close(); err != nil {
414 t.Error(err)
415 }
416
417 if len(trm.errors) != 1 {
418 t.Error("Expected to report a single error")
419 } else if !strings.Contains(trm.errors[0], `ClientID value "not a valid consumer ID" is not valid for Kafka versions before 1.0.0`) {
420 t.Errorf("Unexpected error: %s", trm.errors[0])
421 }
422}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected