(t *testing.T)
| 531 | } |
| 532 | |
| 533 | func 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 | |
| 565 | func TestGroupInstanceIdAndVersionValidation(t *testing.T) { |
| 566 | config := NewTestConfig() |
nothing calls this directly
no test coverage detected