TestInvalidClientIDValidated ensures that the ClientID field is checked when Version is set to anything less than 1_0_0_0, but otherwise accepted
(t *testing.T)
| 38 | // TestInvalidClientIDValidated ensures that the ClientID field is checked |
| 39 | // when Version is set to anything less than 1_0_0_0, but otherwise accepted |
| 40 | func TestInvalidClientIDValidated(t *testing.T) { |
| 41 | for _, version := range SupportedVersions { |
| 42 | for _, clientID := range []string{"", "foo:bar", "foo|bar"} { |
| 43 | config := NewTestConfig() |
| 44 | config.ClientID = clientID |
| 45 | config.Version = version |
| 46 | err := config.Validate() |
| 47 | if config.Version.IsAtLeast(V1_0_0_0) { |
| 48 | assert.NoError(t, err) |
| 49 | continue |
| 50 | } |
| 51 | var target ConfigurationError |
| 52 | assert.ErrorAs(t, err, &target) |
| 53 | assert.ErrorContains(t, err, fmt.Sprintf("ClientID value %q is not valid for Kafka versions before 1.0.0", clientID)) |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | type DummyTokenProvider struct{} |
| 59 |
nothing calls this directly
no test coverage detected