Make IsDNS1123Subdomain return error strings

This commit is contained in:
Tim Hockin
2015-12-16 21:58:09 -08:00
parent 77eff06a53
commit 5862a60ae7
6 changed files with 29 additions and 19 deletions

View File

@@ -4691,7 +4691,7 @@ func TestValidateLimitRange(t *testing.T) {
},
"invalid-name": {
api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "^Invalid", Namespace: "foo"}, Spec: api.LimitRangeSpec{}},
DNSSubdomainErrorMsg,
"must match the regex",
},
"invalid-namespace": {
api.LimitRange{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "^Invalid"}, Spec: api.LimitRangeSpec{}},
@@ -5015,7 +5015,7 @@ func TestValidateResourceQuota(t *testing.T) {
},
"invalid Name": {
api.ResourceQuota{ObjectMeta: api.ObjectMeta{Name: "^Invalid", Namespace: "foo"}, Spec: spec},
DNSSubdomainErrorMsg,
"must match the regex",
},
"invalid Namespace": {
api.ResourceQuota{ObjectMeta: api.ObjectMeta{Name: "abc", Namespace: "^Invalid"}, Spec: spec},
@@ -5618,7 +5618,7 @@ func TestValidateEndpoints(t *testing.T) {
"invalid name": {
endpoints: api.Endpoints{ObjectMeta: api.ObjectMeta{Name: "-_Invliad^&Characters", Namespace: "namespace"}},
errorType: "FieldValueInvalid",
errorDetail: DNSSubdomainErrorMsg,
errorDetail: "must match the regex",
},
"empty addresses": {
endpoints: api.Endpoints{