tests: remove test cases not applicable for docker. (#4951)

When running `make test` in docker, two test cases cause hanging.
This Patch fixes the problem by removing those test cases.

Thanks to @ws141 for identifying the problem.
This commit is contained in:
Bala FA 2017-09-27 13:51:26 -07:00 committed by Dee Koder
parent 02af37a394
commit 3c836b5f34
2 changed files with 2 additions and 15 deletions

View File

@ -31,8 +31,6 @@ func TestNewEndpoint(t *testing.T) {
u3, _ := url.Parse("http://127.0.0.1:8080/path") u3, _ := url.Parse("http://127.0.0.1:8080/path")
u4, _ := url.Parse("http://192.168.253.200/path") u4, _ := url.Parse("http://192.168.253.200/path")
errMsg := ": no such host"
testCases := []struct { testCases := []struct {
arg string arg string
expectedEndpoint Endpoint expectedEndpoint Endpoint
@ -69,7 +67,6 @@ func TestNewEndpoint(t *testing.T) {
{"https://93.184.216.34:808080/path", Endpoint{}, -1, fmt.Errorf("invalid URL endpoint format: port number must be between 1 to 65535")}, {"https://93.184.216.34:808080/path", Endpoint{}, -1, fmt.Errorf("invalid URL endpoint format: port number must be between 1 to 65535")},
{"http://server:8080//", Endpoint{}, -1, fmt.Errorf("empty or root path is not supported in URL endpoint")}, {"http://server:8080//", Endpoint{}, -1, fmt.Errorf("empty or root path is not supported in URL endpoint")},
{"http://server:8080/", Endpoint{}, -1, fmt.Errorf("empty or root path is not supported in URL endpoint")}, {"http://server:8080/", Endpoint{}, -1, fmt.Errorf("empty or root path is not supported in URL endpoint")},
{"http://server/path", Endpoint{}, -1, fmt.Errorf("lookup server" + errMsg)},
{"192.168.1.210:9000", Endpoint{}, -1, fmt.Errorf("invalid URL endpoint format: missing scheme http or https")}, {"192.168.1.210:9000", Endpoint{}, -1, fmt.Errorf("invalid URL endpoint format: missing scheme http or https")},
} }
@ -81,16 +78,8 @@ func TestNewEndpoint(t *testing.T) {
} }
} else if err == nil { } else if err == nil {
t.Fatalf("error: expected = %v, got = <nil>", testCase.expectedErr) t.Fatalf("error: expected = %v, got = <nil>", testCase.expectedErr)
} else { } else if testCase.expectedErr.Error() != err.Error() {
var match bool t.Fatalf("error: expected = %v, got = %v", testCase.expectedErr, err)
if strings.HasSuffix(testCase.expectedErr.Error(), errMsg) {
match = strings.HasSuffix(err.Error(), errMsg)
} else {
match = (testCase.expectedErr.Error() == err.Error())
}
if !match {
t.Fatalf("error: expected = %v, got = %v", testCase.expectedErr, err)
}
} }
if err == nil && !reflect.DeepEqual(testCase.expectedEndpoint, endpoint) { if err == nil && !reflect.DeepEqual(testCase.expectedEndpoint, endpoint) {

View File

@ -128,7 +128,6 @@ func TestMustGetLocalIP4(t *testing.T) {
} }
func TestGetHostIP(t *testing.T) { func TestGetHostIP(t *testing.T) {
_, err := getHostIP4("myserver")
testCases := []struct { testCases := []struct {
host string host string
expectedIPList set.StringSet expectedIPList set.StringSet
@ -136,7 +135,6 @@ func TestGetHostIP(t *testing.T) {
}{ }{
{"localhost", set.CreateStringSet("127.0.0.1"), nil}, {"localhost", set.CreateStringSet("127.0.0.1"), nil},
{"example.org", set.CreateStringSet("93.184.216.34"), nil}, {"example.org", set.CreateStringSet("93.184.216.34"), nil},
{"myserver", nil, err},
} }
for _, testCase := range testCases { for _, testCase := range testCases {