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") }