diff --git a/testsuite/openshift/deployment.py b/testsuite/openshift/deployment.py index 72b5908e..726f897f 100644 --- a/testsuite/openshift/deployment.py +++ b/testsuite/openshift/deployment.py @@ -2,6 +2,8 @@ from testsuite.openshift import OpenShiftObject, Selector from testsuite.utils import asdict +import openshift as oc + class Deployment(OpenShiftObject): """Kubernetes Deployment object""" @@ -40,3 +42,8 @@ def create_instance( } return cls(model, context=openshift.context) + + def wait_for_ready(self, timeout=90): + with oc.timeout(timeout): + success, _, _ = self.self_selector().until_all(success_func=lambda obj: "readyReplicas" in obj.model.status) + assert success, f"Deployment {self.name()} did not get ready in time" diff --git a/testsuite/openshift/httpbin.py b/testsuite/openshift/httpbin.py index 9ccb7003..09f8683e 100644 --- a/testsuite/openshift/httpbin.py +++ b/testsuite/openshift/httpbin.py @@ -43,6 +43,7 @@ def commit(self): labels={"app": self.label}, ) self.deployment.commit() + self.deployment.wait_for_ready() self.service = Service.create_instance( self.openshift, @@ -52,9 +53,6 @@ def commit(self): ) self.service.commit() - with self.openshift.context: - assert self.openshift.is_ready(self.deployment.self_selector()), "Httpbin wasn't ready in time" - def delete(self): with self.openshift.context: if self.service: