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

Function TestValidGroupInstanceId

config_test.go:533–563  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

531}
532
533func TestValidGroupInstanceId(t *testing.T) {
534 tests := []struct {
535 grouptInstanceId string
536 shouldHaveErr bool
537 }{
538 {"groupInstanceId1", false},
539 {"", true},
540 {".", true},
541 {"..", true},
542 {strings.Repeat("a", 250), true},
543 {"group_InstanceId.1", false},
544 {"group-InstanceId1", false},
545 {"group#InstanceId1", true},
546 }
547 for _, testcase := range tests {
548 err := validateGroupInstanceId(testcase.grouptInstanceId)
549 if !testcase.shouldHaveErr {
550 if err != nil {
551 t.Errorf("Expected validGroupInstanceId %s to pass, got error %v", testcase.grouptInstanceId, err)
552 }
553 } else {
554 if err == nil {
555 t.Errorf("Expected validGroupInstanceId %s to be error, got nil", testcase.grouptInstanceId)
556 }
557 var target ConfigurationError
558 if !errors.As(err, &target) {
559 t.Errorf("Excepted err to be ConfigurationError, got %v", err)
560 }
561 }
562 }
563}
564
565func TestGroupInstanceIdAndVersionValidation(t *testing.T) {
566 config := NewTestConfig()

Callers

nothing calls this directly

Calls 2

validateGroupInstanceIdFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected