cloudflared-mirror/hello/hello_test.go

39 lines
792 B
Go
Raw Normal View History

2018-05-03 22:32:30 +00:00
package hello
import (
"testing"
)
func TestCreateTLSListenerHostAndPortSuccess(t *testing.T) {
listener, err := CreateTLSListener("localhost:1234")
defer listener.Close()
if err != nil {
t.Fatal(err)
}
if listener.Addr().String() == "" {
t.Fatal("Fail to find available port")
}
}
func TestCreateTLSListenerOnlyHostSuccess(t *testing.T) {
listener, err := CreateTLSListener("localhost:")
defer listener.Close()
if err != nil {
t.Fatal(err)
}
if listener.Addr().String() == "" {
t.Fatal("Fail to find available port")
}
}
func TestCreateTLSListenerOnlyPortSuccess(t *testing.T) {
listener, err := CreateTLSListener(":8888")
defer listener.Close()
if err != nil {
t.Fatal(err)
}
if listener.Addr().String() == "" {
t.Fatal("Fail to find available port")
}
}