summaryrefslogtreecommitdiffstats
path: root/tests/functional
diff options
context:
space:
mode:
authorApeksha D Khakharia <akhakhar@redhat.com>2018-08-28 13:46:44 +0530
committerApeksha D Khakharia <akhakhar@redhat.com>2018-09-06 20:49:05 +0530
commit1c378d2f3f5d97583ec3310a14679035a967a9e3 (patch)
tree4da5c9ce0c37293d57c8fd74dbf39453f932231e /tests/functional
parent7023a7de286c3ffe8fd07818ae19fe928f276103 (diff)
CNS: adding testcases for storage class
CNS-708,709,713,714,715 Change-Id: I61965e6d8b17b4bb49b10ebe26140945da9c4576 Signed-off-by: Apeksha D Khakharia <akhakhar@redhat.com>
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/common/provisioning/test_storage_class_cases.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/tests/functional/common/provisioning/test_storage_class_cases.py b/tests/functional/common/provisioning/test_storage_class_cases.py
new file mode 100644
index 00000000..283b5440
--- /dev/null
+++ b/tests/functional/common/provisioning/test_storage_class_cases.py
@@ -0,0 +1,71 @@
+import ddt
+from glusto.core import Glusto as g
+
+from cnslibs.cns import cns_baseclass
+from cnslibs.common.dynamic_provisioning import (
+ verify_pvc_status_is_bound,
+)
+from cnslibs.common.openshift_ops import (
+ oc_create_pvc,
+ oc_create_sc,
+ oc_create_secret,
+ oc_delete,
+ wait_for_resource_absence,
+)
+
+
+@ddt.ddt
+class TestStorageClassCases(cns_baseclass.CnsBaseClass):
+
+ @ddt.data(
+ {"volumetype": "dist-rep:3"},
+ {"resturl": "http://10.0.0.1:8080"},
+ {"secretname": "fakesecretname"},
+ {"secretnamespace": "fakenamespace"},
+ {"restuser": "fakeuser"},
+ )
+ def test_sc_glusterfile_incorrect_parameter(
+ self, parameter={}):
+ # Polarion testcase id- CNS-708,709,713,714,715
+
+ sc = self.cns_storage_class['storage_class1']
+ secret = self.cns_secret['secret1']
+ # Create secret file for usage in storage class
+ self.secret_name = oc_create_secret(
+ self.ocp_master_node[0], namespace=secret['namespace'],
+ data_key=self.heketi_cli_key, secret_type=secret['type'])
+ self.addCleanup(
+ oc_delete, self.ocp_master_node[0], 'secret', self.secret_name)
+
+ sc_parameter = {
+ "resturl": sc['resturl'],
+ "secretnamespace": sc['secretnamespace'],
+ "secretname": self.secret_name,
+ "restuser": sc['restuser'],
+ "volumetype": "replicate:3"
+ }
+ sc_parameter.update(parameter)
+
+ # Create storage class
+ self.sc_name = oc_create_sc(
+ self.ocp_master_node[0], **sc_parameter)
+ self.addCleanup(oc_delete, self.ocp_master_node[0], 'sc', self.sc_name)
+
+ # Create PVC
+ self.pvc_name = oc_create_pvc(self.ocp_client[0], self.sc_name)
+ self.addCleanup(
+ wait_for_resource_absence, self.ocp_master_node[0],
+ 'pvc', self.pvc_name)
+ self.addCleanup(oc_delete, self.ocp_master_node[0],
+ 'pvc', self.pvc_name)
+
+ try:
+ verify_pvc_status_is_bound(self.ocp_master_node[0], self.pvc_name)
+ except AssertionError:
+ g.log.info("pvc %s is not in bound state as expected" % (
+ self.pvc_name))
+ else:
+ err_msg = ("pvc %s in bound state, was expected to fail" % (
+ self.pvc_name))
+ g.log.error(err_msg)
+ raise AssertionError(err_msg)