Skip to content

Commit c96cc0e

Browse files
committed
check conn Close error
1 parent e76ab98 commit c96cc0e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

createtopics_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ func TestConnCreateTopics(t *testing.T) {
1616
topic2 := makeTopic()
1717

1818
conn, err := DialContext(context.Background(), "tcp", "localhost:9092")
19-
defer conn.Close()
2019
if err != nil {
21-
panic(err)
20+
t.Fatal(err)
2221
}
2322

23+
defer func() {
24+
err := conn.Close()
25+
if err != nil {
26+
t.Fatalf("failed to close connection: %v", err)
27+
}
28+
}()
29+
2430
controller, _ := conn.Controller()
2531

2632
controllerConn, err := Dial("tcp", net.JoinHostPort(controller.Host, strconv.Itoa(controller.Port)))

0 commit comments

Comments
 (0)