summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs
diff options
context:
space:
mode:
authorAshmitha <asambast@redhat.com>2019-09-10 16:01:56 +0530
committerAshmitha <asambast@redhat.com>2019-09-12 18:13:14 +0530
commitff7b40a09c4029a0a59b6fb96bbe9dc2a19e88e2 (patch)
treee7284f62eb490674742e66b426cdff120e1df931 /openshift-storage-libs
parent8c2db5c9894c4f7b90704143cdc97c919c4fe961 (diff)
Add test case to try creation of storage class with duplicate name
Change-Id: If30737958bc667264fc01fe81d411f406b501918
Diffstat (limited to 'openshift-storage-libs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/baseclass.py2
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
index 306623d..19668b1 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 60748aa..87e5580 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",