Allow an empty service

This commit is contained in:
Clayton Coleman
2014-11-18 12:49:00 -05:00
parent 7f2d0c0f71
commit 2c27f7d332
13 changed files with 198 additions and 32 deletions

View File

@@ -710,8 +710,8 @@ func TestValidateService(t *testing.T) {
Port: 8675,
},
},
// Should fail because the selector is missing.
numErrs: 1,
// Should be ok because the selector is missing.
numErrs: 0,
},
{
name: "valid 1",
@@ -824,12 +824,25 @@ func TestValidateService(t *testing.T) {
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
},
},
Spec: api.ServiceSpec{
Port: 8675,
},
},
numErrs: 1,
},
{
name: "invalid selector",
svc: api.Service{
ObjectMeta: api.ObjectMeta{
Name: "abc123",
Namespace: api.NamespaceDefault,
},
Spec: api.ServiceSpec{
Port: 8675,
Selector: map[string]string{"foo": "bar", "NoUppercaseOrSpecialCharsLike=Equals": "bar"},
},
},
numErrs: 2,
numErrs: 1,
},
}