Skip to content

Commit 440ebd1

Browse files
committed
Fix example test code
This commit adapts the example test case to 1.23.
1 parent 04ecc8c commit 440ebd1

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

content/en/examples/examples_test.go

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,6 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
160160
AllowPodAffinityNamespaceSelector: true,
161161
}
162162

163-
pspValidationOptions := policy_validation.PodSecurityPolicyValidationOptions{
164-
AllowEphemeralVolumeType: true,
165-
}
166-
167163
// Enable CustomPodDNS for testing
168164
// feature.DefaultFeatureGate.Set("CustomPodDNS=true")
169165
switch t := obj.(type) {
@@ -283,11 +279,7 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
283279
if t.Namespace == "" {
284280
t.Namespace = api.NamespaceDefault
285281
}
286-
gv := schema.GroupVersion{
287-
Group: networking.GroupName,
288-
Version: legacyscheme.Scheme.PrioritizedVersionsForGroup(networking.GroupName)[0].Version,
289-
}
290-
errors = networking_validation.ValidateIngressCreate(t, gv)
282+
errors = networking_validation.ValidateIngressCreate(t)
291283
case *networking.IngressClass:
292284
/*
293285
if t.Namespace == "" {
@@ -301,7 +293,7 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
301293
errors = networking_validation.ValidateIngressClass(t)
302294

303295
case *policy.PodSecurityPolicy:
304-
errors = policy_validation.ValidatePodSecurityPolicy(t, pspValidationOptions)
296+
errors = policy_validation.ValidatePodSecurityPolicy(t)
305297
case *apps.ReplicaSet:
306298
if t.Namespace == "" {
307299
t.Namespace = api.NamespaceDefault
@@ -405,7 +397,7 @@ func TestExampleObjectSchemas(t *testing.T) {
405397
},
406398
"admin/dns": {
407399
"busybox": {&api.Pod{}},
408-
"dns-horizontal-autoscaler": {&apps.Deployment{}},
400+
"dns-horizontal-autoscaler": {&api.ServiceAccount{}, &rbac.ClusterRole{}, &rbac.ClusterRoleBinding{}, &apps.Deployment{}},
409401
"dnsutils": {&api.Pod{}},
410402
},
411403
"admin/logging": {
@@ -453,7 +445,7 @@ func TestExampleObjectSchemas(t *testing.T) {
453445
},
454446
"admin/sched": {
455447
"clusterrole": {&rbac.ClusterRole{}},
456-
"my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &rbac.ClusterRoleBinding{}, &apps.Deployment{}},
448+
"my-scheduler": {&api.ServiceAccount{}, &rbac.ClusterRoleBinding{}, &rbac.ClusterRoleBinding{}, &api.ConfigMap{}, &apps.Deployment{}},
457449
"pod1": {&api.Pod{}},
458450
"pod2": {&api.Pod{}},
459451
"pod3": {&api.Pod{}},
@@ -592,6 +584,7 @@ func TestExampleObjectSchemas(t *testing.T) {
592584
},
593585
"pods/probe": {
594586
"exec-liveness": {&api.Pod{}},
587+
"grpc-liveness": {&api.Pod{}},
595588
"http-liveness": {&api.Pod{}},
596589
"pod-with-http-healthcheck": {&api.Pod{}},
597590
"pod-with-tcp-socket-healthcheck": {&api.Pod{}},
@@ -620,11 +613,15 @@ func TestExampleObjectSchemas(t *testing.T) {
620613
"security-context-4": {&api.Pod{}},
621614
},
622615
"pods/storage": {
623-
"projected": {&api.Pod{}},
624-
"pv-claim": {&api.PersistentVolumeClaim{}},
625-
"pv-pod": {&api.Pod{}},
626-
"pv-volume": {&api.PersistentVolume{}},
627-
"redis": {&api.Pod{}},
616+
"projected": {&api.Pod{}},
617+
"projected-secret-downwardapi-configmap": {&api.Pod{}},
618+
"projected-secrets-nondefault-permission-mode": {&api.Pod{}},
619+
"projected-service-account-token": {&api.Pod{}},
620+
"pv-claim": {&api.PersistentVolumeClaim{}},
621+
"pv-duplicate": {&api.Pod{}},
622+
"pv-pod": {&api.Pod{}},
623+
"pv-volume": {&api.PersistentVolume{}},
624+
"redis": {&api.Pod{}},
628625
},
629626
"policy": {
630627
"baseline-psp": {&policy.PodSecurityPolicy{}},

0 commit comments

Comments
 (0)