From 30c009cde35d8cb3b2e755cd9ea71e172c8a4290 Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Wed, 29 May 2019 00:00:47 +0530 Subject: Fix 'test_pv_resize_by_exact_free_space' tc It was broken it 2 places: - It is first tc in the 'resize' test suite, which runs right after OCP API restart. And it happens to fail to talk to the OCP API. So, fix it by adding API service waiter in place where we restart it. - In this tc we delete huge volume which consumes almost whole disk space. And happens that this operation takes up to the 6 minutes. But we were waiting only for 5 minutes. So, just increase timeout. Change-Id: Ic6ada67b96ac8a37d13f57c0576e862226517b0d --- openshift-storage-libs/openshiftstoragelibs/openshift_ops.py | 2 +- .../openshiftstoragelibs/openshift_storage_libs.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'openshift-storage-libs') diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py index b6d086a6..44834dc4 100644 --- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py +++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py @@ -631,7 +631,7 @@ def create_namespace(hostname, namespace): def wait_for_resource_absence(ocp_node, rtype, name, - interval=5, timeout=300): + interval=5, timeout=600): _waiter = waiter.Waiter(timeout=timeout, interval=interval) resource, pv_name = None, None for w in _waiter: diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_storage_libs.py b/openshift-storage-libs/openshiftstoragelibs/openshift_storage_libs.py index e9ad670d..aef63961 100644 --- a/openshift-storage-libs/openshiftstoragelibs/openshift_storage_libs.py +++ b/openshift-storage-libs/openshiftstoragelibs/openshift_storage_libs.py @@ -7,6 +7,7 @@ from openshiftstoragelibs.exceptions import ( NotSupportedException, ) from openshiftstoragelibs.openshift_version import get_openshift_version +from openshiftstoragelibs import waiter MASTER_CONFIG_FILEPATH = "/etc/origin/master/master-config.yaml" @@ -115,7 +116,16 @@ def enable_pvc_resize(master_node): g.log.error(err_msg) raise ExecutionError(err_msg) - return True + # Wait for API service to be ready after the restart + for w in waiter.Waiter(timeout=120, interval=1): + try: + cmd_run("oc get nodes", master_node) + return True + except AssertionError: + continue + err_msg = "Exceeded 120s timeout waiting for OCP API to start responding." + g.log.error(err_msg) + raise ExecutionError(err_msg) def get_iscsi_session(node, iqn=None, raise_on_error=True): -- cgit