From b99a12c2b8b73efb71c2c83c52878fcb4fda6bec Mon Sep 17 00:00:00 2001 From: Nitin Goyal Date: Fri, 7 Feb 2020 21:59:50 +0530 Subject: [Lib] Add paramter for custom prefix in lib create_dcs_with_pvc Change-Id: Ifb9c582c18d9e7a8bfd01d3b6a45e105c9ad8db4 --- openshift-storage-libs/openshiftstoragelibs/baseclass.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'openshift-storage-libs/openshiftstoragelibs') diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py index f30c2bad..fd2c3937 100644 --- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py +++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py @@ -387,7 +387,8 @@ class BaseClass(unittest.TestCase): skip_cleanup=skip_cleanup) def create_dcs_with_pvc( - self, pvc_names, timeout=600, wait_step=5, skip_cleanup=False): + self, pvc_names, timeout=600, wait_step=5, + dc_name_prefix='autotests-dc', skip_cleanup=False): """Create bunch of DCs with app PODs which use unique PVCs. Args: @@ -395,6 +396,7 @@ class BaseClass(unittest.TestCase): to attach to app PODs as part of DCs. timeout (int): timeout value, default value is 600 seconds. wait_step( int): wait step, default value is 5 seconds. + dc_name_prefix(str): name prefix for deployement config. Returns: dictionary with following structure: { "pvc_name_1": ("dc_name_1", "pod_name_1"), @@ -408,7 +410,8 @@ class BaseClass(unittest.TestCase): if isinstance(pvc_names, (list, set, tuple)) else [pvc_names]) dc_and_pod_names, dc_names = {}, {} for pvc_name in pvc_names: - dc_name = oc_create_app_dc_with_io(self.ocp_client[0], pvc_name) + dc_name = oc_create_app_dc_with_io( + self.ocp_client[0], pvc_name, dc_name_prefix=dc_name_prefix) dc_names[pvc_name] = dc_name if not skip_cleanup: self.addCleanup(oc_delete, self.ocp_client[0], 'dc', dc_name) @@ -427,9 +430,11 @@ class BaseClass(unittest.TestCase): return dc_and_pod_names def create_dc_with_pvc( - self, pvc_name, timeout=300, wait_step=10, skip_cleanup=False): + self, pvc_name, timeout=300, wait_step=10, + dc_name_prefix='autotests-dc', skip_cleanup=False): return self.create_dcs_with_pvc( - pvc_name, timeout, wait_step, skip_cleanup=skip_cleanup)[pvc_name] + pvc_name, timeout, wait_step, + dc_name_prefix=dc_name_prefix, skip_cleanup=skip_cleanup)[pvc_name] def create_heketi_volume_with_name_and_wait( self, name, size, raise_on_cleanup_error=True, -- cgit