(t *testing.T, mechanism sasl.Mechanism, success bool)
| 89 | } |
| 90 | |
| 91 | func testConnect(t *testing.T, mechanism sasl.Mechanism, success bool) { |
| 92 | ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 93 | defer cancel() |
| 94 | |
| 95 | d := kafka.Dialer{ |
| 96 | SASLMechanism: mechanism, |
| 97 | } |
| 98 | _, err := d.DialLeader(ctx, "tcp", saslTestConnect, saslTestTopic, 0) |
| 99 | if success && err != nil { |
| 100 | t.Errorf("should have logged in correctly, got err: %v", err) |
| 101 | } else if !success && err == nil { |
| 102 | t.Errorf("should not have logged in correctly") |
| 103 | } |
| 104 | } |