diff --git a/cmd/endpoint_test.go b/cmd/endpoint_test.go index e93dd1013..ce093b15e 100644 --- a/cmd/endpoint_test.go +++ b/cmd/endpoint_test.go @@ -31,8 +31,6 @@ func TestNewEndpoint(t *testing.T) { u3, _ := url.Parse("http://127.0.0.1:8080/path") u4, _ := url.Parse("http://192.168.253.200/path") - errMsg := ": no such host" - testCases := []struct { arg string 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")}, {"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")}, } @@ -81,16 +78,8 @@ func TestNewEndpoint(t *testing.T) { } } else if err == nil { t.Fatalf("error: expected = %v, got = ", testCase.expectedErr) - } else { - var match bool - 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) - } + } else if testCase.expectedErr.Error() != err.Error() { + t.Fatalf("error: expected = %v, got = %v", testCase.expectedErr, err) } if err == nil && !reflect.DeepEqual(testCase.expectedEndpoint, endpoint) { diff --git a/cmd/net_test.go b/cmd/net_test.go index 4dde1d9b2..a65bcd0ef 100644 --- a/cmd/net_test.go +++ b/cmd/net_test.go @@ -128,7 +128,6 @@ func TestMustGetLocalIP4(t *testing.T) { } func TestGetHostIP(t *testing.T) { - _, err := getHostIP4("myserver") testCases := []struct { host string expectedIPList set.StringSet @@ -136,7 +135,6 @@ func TestGetHostIP(t *testing.T) { }{ {"localhost", set.CreateStringSet("127.0.0.1"), nil}, {"example.org", set.CreateStringSet("93.184.216.34"), nil}, - {"myserver", nil, err}, } for _, testCase := range testCases {