Skip to content

Commit

Permalink
Merge pull request #2116 from ShazaAldawamneh/CRD_type_check
Browse files Browse the repository at this point in the history
OCPBUGS-39004: CRD type check test fix
  • Loading branch information
openshift-merge-bot[bot] authored Oct 22, 2024
2 parents 81c1851 + 71c0639 commit 33d201f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/e2e/apimachinery/validatingadmissionpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,15 @@ var _ = SIGDescribe("ValidatingAdmissionPolicy [Privileged:ClusterAdmin]", func(
// TODO(#123829) Remove once the schema watcher is merged.
// If the warnings are empty, touch the policy to retry type checking
if len(policy.Status.TypeChecking.ExpressionWarnings) == 0 {
applyConfig := applyadmissionregistrationv1.ValidatingAdmissionPolicy(policy.Name).WithLabels(map[string]string{
"touched": fmt.Sprintf("a%d", time.Now().UnixMilli()),
"random": fmt.Sprintf("a%d", rand.Int()),
})
randomValue := fmt.Sprintf(`"%d"`, rand.Int())
// Use a fixed key and change only the value
applyConfig := applyadmissionregistrationv1.ValidatingAdmissionPolicy(policy.Name).
WithSpec(applyadmissionregistrationv1.ValidatingAdmissionPolicySpec().
WithAuditAnnotations(applyadmissionregistrationv1.AuditAnnotation().
WithKey("key").
WithValueExpression(randomValue),
),
)
_, err := client.AdmissionregistrationV1().ValidatingAdmissionPolicies().Apply(ctx, applyConfig, metav1.ApplyOptions{FieldManager: "validatingadmissionpolicy-e2e"})
return false, err
}
Expand Down

0 comments on commit 33d201f

Please sign in to comment.