diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-05-10 16:40:39 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2018-05-10 16:40:39 +0530 |
commit | 2bee3d332568b1e153b8a46c59253a750feea8e5 (patch) | |
tree | e8ac2a297b0c78a11605536b18ae4a4381d82d86 /cns-libs/cnslibs/common/openshift_ops.py | |
parent | 695e5f44ab03db37248e8e920ee6071e24536d2f (diff) |
Fix broken dynamic_provisioning tests
Fix 2 autotests, remove skip decorator for them.
And rework logic of mongodb template uploading for mongodb pod,
so it takes couple of seconds instead of minutes.
Change-Id: Ib2b09364ae435b9784b76c2f2581c197128f9649
Diffstat (limited to 'cns-libs/cnslibs/common/openshift_ops.py')
-rw-r--r-- | cns-libs/cnslibs/common/openshift_ops.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/cns-libs/cnslibs/common/openshift_ops.py b/cns-libs/cnslibs/common/openshift_ops.py index 3d3dd061..84edfdd6 100644 --- a/cns-libs/cnslibs/common/openshift_ops.py +++ b/cns-libs/cnslibs/common/openshift_ops.py @@ -6,9 +6,11 @@ Various utility functions for interacting with OCP/OpenShift. import re import types +from glusto.core import Glusto as g import yaml -from glusto.core import Glusto as g +from cnslibs.common import exceptions +from cnslibs.common import waiter PODS_WIDE_RE = re.compile( @@ -291,3 +293,17 @@ def create_namespace(hostname, namespace): return True g.log.error("failed to create namespace %s" % namespace) return False + + +def wait_for_resource_absence(ocp_node, rtype, name, + interval=10, timeout=120): + for w in waiter.Waiter(timeout=timeout, interval=interval): + try: + oc_get_yaml(ocp_node, rtype, name, raise_on_error=True) + except AssertionError: + return + if w.expired: + error_msg = "%s '%s' still exists after waiting for it %d seconds" % ( + rtype, name, timeout) + g.log.error(error_msg) + raise exceptions.ExecutionError(error_msg) |