From 2f5d62f8df8f752fef847b701d501423b0117147 Mon Sep 17 00:00:00 2001 From: Justin Kulikauskas Date: Tue, 7 May 2024 15:19:17 -0400 Subject: [PATCH] Wait for deployment in CRD status test Refs: - https://issues.redhat.com/browse/ACM-11451 Signed-off-by: Justin Kulikauskas (cherry picked from commit d734b7aa1ec2ae936edb48ec622b29ac70871921) --- test/e2e/case38_install_operator_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/e2e/case38_install_operator_test.go b/test/e2e/case38_install_operator_test.go index 188be5a4..e8b9fe0e 100644 --- a/test/e2e/case38_install_operator_test.go +++ b/test/e2e/case38_install_operator_test.go @@ -11,9 +11,11 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + appsv1 "k8s.io/api/apps/v1" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" policyv1 "open-cluster-management.io/config-policy-controller/api/v1" policyv1beta1 "open-cluster-management.io/config-policy-controller/api/v1beta1" @@ -1404,6 +1406,22 @@ var _ = Describe("Testing OperatorPolicy", Ordered, func() { return crd }, olmWaitTimeout, 5, ctx).ShouldNot(BeNil()) + By("Waiting for the Deployment to be available, indicating the installation is complete") + Eventually(func(g Gomega) { + dep, err := clientManagedDynamic.Resource(gvrDeployment).Namespace(opPolTestNS).Get( + ctx, "quay-operator-tng", metav1.GetOptions{}) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(dep).NotTo(BeNil()) + + var deploy appsv1.Deployment + + err = runtime.DefaultUnstructuredConverter.FromUnstructured(dep.Object, &deploy) + g.Expect(err).NotTo(HaveOccurred()) + + g.Expect(deploy.Status.Replicas).NotTo(BeZero()) + g.Expect(deploy.Status.ReadyReplicas).To(Equal(deploy.Status.Replicas)) + }, olmWaitTimeout, 5).Should(Succeed()) + check( opPolName, false,