mirror of
https://github.com/pgsty/minio.git
synced 2026-07-15 16:30:29 +03:00
notifiers: Stop using url.Parse in validating address format. (#4011)
url.Parse() wrongly parses an address of format "address:port" which is fixed in go1.8. This inculcates a breaking change on our end. We should fix this wrong usage everywhere so that migrating to go1.8 eventually becomes smoother.
This commit is contained in:
+3
-5
@@ -389,16 +389,14 @@ func TestLocalAddress(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
// TestCheckURL tests valid address
|
||||
// TestCheckURL tests valid url.
|
||||
func TestCheckURL(t *testing.T) {
|
||||
testCases := []struct {
|
||||
addr string
|
||||
urlStr string
|
||||
shouldPass bool
|
||||
}{
|
||||
{"", false},
|
||||
{":", false},
|
||||
{"localhost", true},
|
||||
{"127.0.0.1", true},
|
||||
{"http://localhost/", true},
|
||||
{"http://127.0.0.1/", true},
|
||||
{"proto://myhostname/path", true},
|
||||
@@ -406,7 +404,7 @@ func TestCheckURL(t *testing.T) {
|
||||
|
||||
// Validates fetching local address.
|
||||
for i, testCase := range testCases {
|
||||
_, err := checkURL(testCase.addr)
|
||||
_, err := checkURL(testCase.urlStr)
|
||||
if testCase.shouldPass && err != nil {
|
||||
t.Errorf("Test %d: expected to pass but got an error: %v\n", i+1, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user