From e012567e38d8f5957aa7bc27b4a35e67ba665498 Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Sat, 24 Nov 2018 04:47:58 +0530 Subject: Add 'openshift_version.py' module With growth of amount of test cases and supported OpenShift versions we need to perform more and more version comparisons. So, this module is designed to ease such operations. Usage example: from cnslibs.common import openshift_version version = openshift_version.get_openshift_version() if '3.9' < version <= '3.11': # Do stuff for OpenShift 3.11 or 3.10 elif version <= '3.9': # Do stuff for OpenShift 3.9 or lower else: # Do stuff for higher versions than 3.11 Also, reuse it in all the existing places with version comparisons. Change-Id: Ibc27eff20ed0dff80deca73d5d156e23bda57439 --- tests/functional/common/provisioning/test_pv_resize.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/functional/common/provisioning/test_pv_resize.py b/tests/functional/common/provisioning/test_pv_resize.py index 353aa220..41f5e113 100644 --- a/tests/functional/common/provisioning/test_pv_resize.py +++ b/tests/functional/common/provisioning/test_pv_resize.py @@ -9,13 +9,13 @@ from cnslibs.common.openshift_ops import ( oc_create_app_dc_with_io, oc_delete, oc_rsh, - oc_version, scale_dc_pod_amount_and_wait, verify_pv_size, verify_pvc_size, wait_for_events, wait_for_pod_be_ready, wait_for_resource_absence) +from cnslibs.common.openshift_version import get_openshift_version from cnslibs.cns.cns_baseclass import CnsBaseClass from cnslibs.common.exceptions import ExecutionError from glusto.core import Glusto as g @@ -29,8 +29,7 @@ class TestPvResizeClass(CnsBaseClass): def setUpClass(cls): super(TestPvResizeClass, cls).setUpClass() cls.node = cls.ocp_master_node[0] - cls.version = oc_version(cls.node) - if any(v in cls.version for v in ("3.6", "3.7", "3.8")): + if get_openshift_version() < "3.9": cls.skip_me = True return enable_pvc_resize(cls.node) -- cgit