diff options
author | Ashmitha <asambast@redhat.com> | 2019-09-10 16:01:56 +0530 |
---|---|---|
committer | Ashmitha <asambast@redhat.com> | 2019-09-12 18:13:14 +0530 |
commit | ff7b40a09c4029a0a59b6fb96bbe9dc2a19e88e2 (patch) | |
tree | e7284f62eb490674742e66b426cdff120e1df931 /openshift-storage-libs/openshiftstoragelibs | |
parent | 8c2db5c9894c4f7b90704143cdc97c919c4fe961 (diff) |
Add test case to try creation of storage class with duplicate name
Change-Id: If30737958bc667264fc01fe81d411f406b501918
Diffstat (limited to 'openshift-storage-libs/openshiftstoragelibs')
-rw-r--r-- | openshift-storage-libs/openshiftstoragelibs/baseclass.py | 2 | ||||
-rw-r--r-- | openshift-storage-libs/openshiftstoragelibs/openshift_ops.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py index 306623da..19668b17 100644 --- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py +++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py @@ -153,6 +153,7 @@ class BaseClass(unittest.TestCase): def create_storage_class(self, secret_name=None, sc_name_prefix="autotests-sc", + sc_name=None, create_vol_name_prefix=False, vol_name_prefix=None, allow_volume_expansion=False, @@ -194,6 +195,7 @@ class BaseClass(unittest.TestCase): self.sc_name = oc_create_sc( self.ocp_client[0], sc_name_prefix=sc_name_prefix, + sc_name=sc_name, provisioner=provisioner, allow_volume_expansion=allow_volume_expansion, reclaim_policy=reclaim_policy, diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py index 60748aa0..87e55806 100644 --- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py +++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py @@ -269,7 +269,7 @@ def oc_create_secret(hostname, secret_name_prefix="autotests-secret", def oc_create_sc(hostname, sc_name_prefix="autotests-sc", provisioner="kubernetes.io/glusterfs", allow_volume_expansion=False, - reclaim_policy="Delete", **parameters): + reclaim_policy="Delete", sc_name=None, **parameters): """Create storage class using data provided as stdin input. Args: @@ -292,7 +292,8 @@ def oc_create_sc(hostname, sc_name_prefix="autotests-sc", for parameter in parameters.keys(): if parameter.lower() not in allowed_parameters: parameters.pop(parameter) - sc_name = "%s-%s" % (sc_name_prefix, utils.get_random_str()) + if not sc_name: + sc_name = "%s-%s" % (sc_name_prefix, utils.get_random_str()) sc_data = json.dumps({ "kind": "StorageClass", "apiVersion": "storage.k8s.io/v1", |