Skip to content

Commit 69e30cd

Browse files
authored
Merge pull request kubernetes#128263 from ShazaAldawamneh/typecheck-retry-generation
CRD type check test fix
2 parents ff5cb37 + 4b54577 commit 69e30cd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/e2e/apimachinery/validatingadmissionpolicy.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,15 @@ var _ = SIGDescribe("ValidatingAdmissionPolicy [Privileged:ClusterAdmin]", func(
366366
// TODO(#123829) Remove once the schema watcher is merged.
367367
// If the warnings are empty, touch the policy to retry type checking
368368
if len(policy.Status.TypeChecking.ExpressionWarnings) == 0 {
369-
applyConfig := applyadmissionregistrationv1.ValidatingAdmissionPolicy(policy.Name).WithLabels(map[string]string{
370-
"touched": fmt.Sprintf("a%d", time.Now().UnixMilli()),
371-
"random": fmt.Sprintf("a%d", rand.Int()),
372-
})
369+
randomValue := fmt.Sprintf(`"%d"`, rand.Int())
370+
// Use a fixed key and change only the value
371+
applyConfig := applyadmissionregistrationv1.ValidatingAdmissionPolicy(policy.Name).
372+
WithSpec(applyadmissionregistrationv1.ValidatingAdmissionPolicySpec().
373+
WithAuditAnnotations(applyadmissionregistrationv1.AuditAnnotation().
374+
WithKey("key").
375+
WithValueExpression(randomValue),
376+
),
377+
)
373378
_, err := client.AdmissionregistrationV1().ValidatingAdmissionPolicies().Apply(ctx, applyConfig, metav1.ApplyOptions{FieldManager: "validatingadmissionpolicy-e2e"})
374379
return false, err
375380
}

0 commit comments

Comments
 (0)