Consider endpoint path when checking default host.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-08-09 18:22:08 -07:00
parent a7481289bb
commit 005f9f7378
2 changed files with 23 additions and 7 deletions

View File

@@ -147,6 +147,19 @@ func TestAddDefaultEndpoint(t *testing.T) {
"https://registry-3.io",
},
},
"default endpoint in list with path": {
endpoints: []string{
"https://registry-1.io",
"https://registry-2.io",
"https://registry-3.io/path",
},
host: "registry-3.io",
expected: []string{
"https://registry-1.io",
"https://registry-2.io",
"https://registry-3.io/path",
},
},
} {
t.Logf("TestCase %q", desc)
got, err := addDefaultEndpoint(test.endpoints, test.host)