core/v1: add validation and defaulting unit tests for when internalTrafficPolicy is nil and Service type is ExternalName
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
This commit is contained in:
@@ -12281,6 +12281,16 @@ func TestValidateServiceCreate(t *testing.T) {
|
||||
featureGates: []featuregate.Feature{features.ServiceInternalTrafficPolicy},
|
||||
numErrs: 1,
|
||||
},
|
||||
{
|
||||
name: "internalTrafficPolicy field nil when type is ExternalName",
|
||||
tweakSvc: func(s *core.Service) {
|
||||
s.Spec.InternalTrafficPolicy = nil
|
||||
s.Spec.Type = core.ServiceTypeExternalName
|
||||
s.Spec.ExternalName = "foo.bar.com"
|
||||
},
|
||||
featureGates: []featuregate.Feature{features.ServiceInternalTrafficPolicy},
|
||||
numErrs: 0,
|
||||
},
|
||||
{
|
||||
name: "invalid internalTraffic field",
|
||||
tweakSvc: func(s *core.Service) {
|
||||
|
Reference in New Issue
Block a user