Browse Source

Merge pull request #8474 from heyitsanthony/netutil-cmp

netutil: test schemes for URLStringsEqual
Anthony Romano 8 years ago
parent
commit
4c725cee26
1 changed files with 15 additions and 0 deletions
  1. 15 0
      pkg/netutil/netutil_test.go

+ 15 - 0
pkg/netutil/netutil_test.go

@@ -178,6 +178,21 @@ func TestURLsEqual(t *testing.T) {
 			b:      []url.URL{{Scheme: "http", Host: "10.0.10.1:2379"}},
 			b:      []url.URL{{Scheme: "http", Host: "10.0.10.1:2379"}},
 			expect: true,
 			expect: true,
 		},
 		},
+		{
+			a:      []url.URL{{Scheme: "http", Host: "example.com:2379"}},
+			b:      []url.URL{{Scheme: "https", Host: "10.0.10.1:2379"}},
+			expect: false,
+		},
+		{
+			a:      []url.URL{{Scheme: "https", Host: "example.com:2379"}},
+			b:      []url.URL{{Scheme: "http", Host: "10.0.10.1:2379"}},
+			expect: false,
+		},
+		{
+			a:      []url.URL{{Scheme: "unix", Host: "abc:2379"}},
+			b:      []url.URL{{Scheme: "unix", Host: "abc:2379"}},
+			expect: true,
+		},
 		{
 		{
 			a:      []url.URL{{Scheme: "http", Host: "127.0.0.1:2379"}, {Scheme: "http", Host: "127.0.0.1:2380"}},
 			a:      []url.URL{{Scheme: "http", Host: "127.0.0.1:2379"}, {Scheme: "http", Host: "127.0.0.1:2380"}},
 			b:      []url.URL{{Scheme: "http", Host: "127.0.0.1:2379"}, {Scheme: "http", Host: "127.0.0.1:2380"}},
 			b:      []url.URL{{Scheme: "http", Host: "127.0.0.1:2379"}, {Scheme: "http", Host: "127.0.0.1:2380"}},