MCPcopy
hub / github.com/segmentio/kafka-go / TestIssue477

Function TestIssue477

transport_test.go:16–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestIssue477(t *testing.T) {
17 // This test verifies that a connection attempt with a minimal TLS
18 // configuration does not panic.
19 l, err := net.Listen("tcp", "127.0.0.1:0")
20 if err != nil {
21 t.Fatal(err)
22 }
23 defer l.Close()
24
25 cg := connGroup{
26 addr: l.Addr(),
27 pool: &connPool{
28 dial: defaultDialer.DialContext,
29 tls: &tls.Config{},
30 },
31 }
32
33 if _, err := cg.connect(context.Background(), cg.addr); err != nil {
34 // An error is expected here because we are not actually establishing
35 // a TLS connection to a kafka broker.
36 t.Log(err)
37 } else {
38 t.Error("no error was reported when attempting to establish a TLS connection to a non-TLS endpoint")
39 }
40}
41
42func TestIssue672(t *testing.T) {
43 // ensure the test times out if the bug is re-introduced

Callers

nothing calls this directly

Calls 3

connectMethod · 0.95
CloseMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected