Allow leading * in ingress hostname

This commit is contained in:
Manuel de Brito Fontes
2016-07-19 11:10:18 -04:00
parent a898438448
commit 60f4fbf4f2
4 changed files with 151 additions and 8 deletions

View File

@@ -407,3 +407,29 @@ func TestIsConfigMapKey(t *testing.T) {
}
}
}
func TestIsWildcardDNS1123Subdomain(t *testing.T) {
goodValues := []string{
"*.example.com",
"*.bar.com",
"*.foo.bar.com",
}
for _, val := range goodValues {
if errs := IsWildcardDNS1123Subdomain(val); len(errs) != 0 {
t.Errorf("expected no errors for %q: %v", val, errs)
}
}
badValues := []string{
"*.*.bar.com",
"*.foo.*.com",
"*bar.com",
"f*.bar.com",
"*",
}
for _, val := range badValues {
if errs := IsWildcardDNS1123Subdomain(val); len(errs) == 0 {
t.Errorf("expected errors for %q", val)
}
}
}