1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 10:04:25 +00:00

Retry policy creation to avoid flaky CRD readiness ()

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
This commit is contained in:
Sambhav Kothari 2022-05-01 23:42:14 +01:00 committed by GitHub
parent d980a3b883
commit 8342d86a9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -67,7 +67,7 @@ func TestImageVerify(t *testing.T) {
})
// Created CRD is not a garantee that we already can create new resources
time.Sleep(10 * time.Second)
time.Sleep(15 * time.Second)
for _, tcase := range VerifyImagesTests {
test := tcase
@ -107,8 +107,15 @@ func TestImageVerify(t *testing.T) {
Expect(err).NotTo(HaveOccurred())
// Create policy
By(fmt.Sprintf("Creating policy in \"%s\"", policyNamespace))
_, err = e2eClient.CreateClusteredResourceYaml(policyGVR, test.PolicyRaw)
By(fmt.Sprintf("Creating policy \"%s\"", test.PolicyName))
err = e2e.GetWithRetry(1*time.Second, 30, func() error {
_, err := e2eClient.CreateClusteredResourceYaml(policyGVR, test.PolicyRaw)
if err != nil {
return err
}
return nil
})
Expect(err).NotTo(HaveOccurred())
Expect(e2eClient.ClusterPolicyReady(test.PolicyName)).To(BeTrue())