summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Kumar <arukumar@localhost.localdomain>2019-03-20 16:23:40 +0530
committerArun Kumar <arukumar@redhat.com>2019-03-29 14:33:53 +0530
commitdfb5c75638c1ae8ee681e7fc92b24515697fa920 (patch)
treeaf5c3791138caa362322c1679ed718d230925b14
parent831a510f8594bb14cbb076d04fcf7d6fd52dfb38 (diff)
Add checks for PVC creation without vol_name prefix
Check if volume name is combination of string 'vol_' and volume id and check volume is present in heketidb and gluster cluster. Change-Id: I755a6447fe653a4ba148798f4c0317aa08a4a4eb
-rw-r--r--tests/functional/provisioning/test_dynamic_provisioning_file.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/functional/provisioning/test_dynamic_provisioning_file.py b/tests/functional/provisioning/test_dynamic_provisioning_file.py
index 7286fde7..e63a3035 100644
--- a/tests/functional/provisioning/test_dynamic_provisioning_file.py
+++ b/tests/functional/provisioning/test_dynamic_provisioning_file.py
@@ -6,10 +6,12 @@ from openshiftstoragelibs.baseclass import BaseClass
from openshiftstoragelibs.exceptions import ExecutionError
from openshiftstoragelibs.heketi_ops import (
heketi_volume_delete,
+ heketi_volume_info,
heketi_volume_list,
verify_volume_name_prefix,
)
from openshiftstoragelibs.openshift_ops import (
+ cmd_run_on_gluster_pod_or_node,
get_gluster_pod_names_by_pvc_name,
get_pv_name_from_pvc,
get_pod_name_from_dc,
@@ -62,6 +64,32 @@ class TestDynamicProvisioningP0(BaseClass):
self.sc['secretnamespace'],
pvc_name, self.sc['resturl'])
self.assertTrue(ret, "verify volnameprefix failed")
+ else:
+ # Get the volume name and volume id from PV
+ pv_name = get_pv_name_from_pvc(self.ocp_client[0], pvc_name)
+ custom = [
+ r':spec.glusterfs.path',
+ r':metadata.annotations.'
+ r'"gluster\.kubernetes\.io\/heketi-volume-id"'
+ ]
+ pv_vol_name, vol_id = oc_get_custom_resource(
+ self.ocp_client[0], 'pv', custom, pv_name)
+
+ # check if the pv_volume_name is present in heketi
+ # Check if volume name is "vol_"+volumeid or not
+ heketi_vol_name = heketi_volume_info(
+ self.ocp_client[0], self.heketi_server_url, vol_id,
+ json=True)['name']
+ self.assertEqual(pv_vol_name, heketi_vol_name,
+ 'Volume with vol_id = %s not found'
+ 'in heketidb' % vol_id)
+ self.assertEqual(heketi_vol_name, 'vol_' + vol_id,
+ 'Volume with vol_id = %s have a'
+ 'custom perfix' % vol_id)
+ out = cmd_run_on_gluster_pod_or_node(self.ocp_master_node[0],
+ "gluster volume list")
+ self.assertIn(pv_vol_name, out,
+ "Volume with id %s does not exist" % vol_id)
# Make sure we are able to work with files on the mounted volume
filepath = "/mnt/file_for_testing_io.log"