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

Function TestInvalidClientIDValidated

config_test.go:40–56  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
40func 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
58type DummyTokenProvider struct{}
59

Callers

nothing calls this directly

Calls 3

ValidateMethod · 0.80
IsAtLeastMethod · 0.80
NewTestConfigFunction · 0.70

Tested by

no test coverage detected