From 7c084ad32b1033af8199c8953d4949cca82132b9 Mon Sep 17 00:00:00 2001 From: Chung-Ting Huang Date: Wed, 25 Jul 2018 09:07:27 -0500 Subject: [PATCH] TUN-814: Handle error in CreateTLSListener before closing listener --- hello/hello_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hello/hello_test.go b/hello/hello_test.go index 3a049c8a..d88f478a 100644 --- a/hello/hello_test.go +++ b/hello/hello_test.go @@ -6,10 +6,10 @@ import ( func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) { listener, err := CreateTLSListener("localhost:1234") - defer listener.Close() if err != nil { t.Fatal(err) } + defer listener.Close() if listener.Addr().String() == "" { t.Fatal("Fail to find available port") } @@ -17,10 +17,10 @@ func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) { func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) { listener, err := CreateTLSListener("localhost:") - defer listener.Close() if err != nil { t.Fatal(err) } + defer listener.Close() if listener.Addr().String() == "" { t.Fatal("Fail to find available port") } @@ -28,10 +28,10 @@ func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) { func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) { listener, err := CreateTLSListener(":8888") - defer listener.Close() if err != nil { t.Fatal(err) } + defer listener.Close() if listener.Addr().String() == "" { t.Fatal("Fail to find available port") }