TUN-814: Handle error in CreateTLSListener before closing listener
This commit is contained in:
parent
0468866626
commit
7c084ad32b
|
@ -6,10 +6,10 @@ import (
|
||||||
|
|
||||||
func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) {
|
func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) {
|
||||||
listener, err := CreateTLSListener("localhost:1234")
|
listener, err := CreateTLSListener("localhost:1234")
|
||||||
defer listener.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer listener.Close()
|
||||||
if listener.Addr().String() == "" {
|
if listener.Addr().String() == "" {
|
||||||
t.Fatal("Fail to find available port")
|
t.Fatal("Fail to find available port")
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@ func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) {
|
||||||
|
|
||||||
func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
|
func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
|
||||||
listener, err := CreateTLSListener("localhost:")
|
listener, err := CreateTLSListener("localhost:")
|
||||||
defer listener.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer listener.Close()
|
||||||
if listener.Addr().String() == "" {
|
if listener.Addr().String() == "" {
|
||||||
t.Fatal("Fail to find available port")
|
t.Fatal("Fail to find available port")
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,10 @@ func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
|
||||||
|
|
||||||
func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) {
|
func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) {
|
||||||
listener, err := CreateTLSListener(":8888")
|
listener, err := CreateTLSListener(":8888")
|
||||||
defer listener.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer listener.Close()
|
||||||
if listener.Addr().String() == "" {
|
if listener.Addr().String() == "" {
|
||||||
t.Fatal("Fail to find available port")
|
t.Fatal("Fail to find available port")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue