Skip to content

Commit

Permalink
Wait for deployment in CRD status test
Browse files Browse the repository at this point in the history
Refs:
 - https://issues.redhat.com/browse/ACM-11451

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
(cherry picked from commit d734b7a)
  • Loading branch information
JustinKuli authored and openshift-merge-bot[bot] committed May 7, 2024
1 parent 5fc03fb commit 2f5d62f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/e2e/case38_install_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2f5d62f

Please sign in to comment.