summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSushilG96 <guptarahul201010@gmail.com>2020-06-15 18:22:32 +0530
committerVaibhav Mahajan <vamahaja@redhat.com>2020-06-16 07:20:43 +0000
commitd832915383a19a3774be5b2f4ff4d401d9af6228 (patch)
treecbcccd0dc345e01d801a968916d7250cd7bc7f0c /tests
parent3a876a608c605212902f89cd5e918d5a43c2736f (diff)
[Test] Add tc to compare file/block volume from all nodes
Change-Id: I440f8e8a5b763735479896c336ebc233fe04f179 Signed-off-by: susgupta <susgupta@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/heketi/test_server_state_examine_gluster.py51
1 files changed, 28 insertions, 23 deletions
diff --git a/tests/functional/heketi/test_server_state_examine_gluster.py b/tests/functional/heketi/test_server_state_examine_gluster.py
index 9b995cb..bb2b3d4 100644
--- a/tests/functional/heketi/test_server_state_examine_gluster.py
+++ b/tests/functional/heketi/test_server_state_examine_gluster.py
@@ -124,35 +124,40 @@ class TestHeketiServerStateExamineGluster(BaseClass):
self.assertEqual(topology_bricks_count, db_bricks_count, msg)
@pytest.mark.tier1
- def test_compare_block_volumes(self):
- """Validate blockvolume count using heketi gluster examine"""
- # Create some blockvolumes
- size = 1
+ @ddt.data('', 'block')
+ def test_compare_heketi_volumes(self, vol_type):
+ """Validate file/block volume count using heketi gluster examine"""
+ # Create some file/block volumes
+ vol_size = 1
+ h_node, h_url = self.heketi_client_node, self.heketi_server_url
+
for i in range(5):
- volume = heketi_ops.heketi_blockvolume_create(
- self.heketi_client_node, self.heketi_server_url, size,
- json=True)['id']
+ volume = eval(
+ "heketi_ops.heketi_{}volume_create".format(vol_type))(
+ h_node, h_url, vol_size, json=True)['id']
self.addCleanup(
- heketi_ops.heketi_blockvolume_delete,
- self.heketi_client_node, self.heketi_server_url, volume)
+ eval("heketi_ops.heketi_{}volume_delete".format(vol_type)),
+ h_node, h_url, volume)
- # Get the list of blockvolumes from heketi gluster examine
+ # Get the list of file/block volumes from heketi gluster examine
out = heketi_ops.heketi_examine_gluster(
self.heketi_client_node, self.heketi_server_url)
- examine_blockvolumes, clusters = [], out['heketidb']['clusterentries']
+ examine_volumes, clusters = [], out['heketidb']['clusterentries']
for cluster in clusters.values():
- examine_blockvolumes += cluster['Info']['blockvolumes']
-
- # Get list of blockvolume from heketi blockvolume list
- heketi_block_volumes = heketi_ops.heketi_blockvolume_list(
- self.heketi_client_node, self.heketi_server_url,
- json=True)['blockvolumes']
-
- # Compare volume list
- msg = ("Heketi blockvolume list {} and list of blockvolumes in heketi "
- "gluster examine {} are not same".format(
- heketi_block_volumes, examine_blockvolumes))
- self.assertEqual(heketi_block_volumes, examine_blockvolumes, msg)
+ examine_volumes += cluster['Info']['{}volumes'.format(vol_type)]
+
+ # Get list of file/block volume from heketi blockvolume list
+ heketi_volumes = eval(
+ "heketi_ops.heketi_{}volume_list".format(vol_type))(
+ h_node, h_url, json=True)['{}volumes'.format(vol_type)]
+
+ # Compare file/block volume list
+ self.assertEqual(
+ heketi_volumes,
+ examine_volumes,
+ "Heketi {}volume list {} and list of blockvolumes in heketi "
+ "gluster examine {} are not same".format(
+ vol_type, heketi_volumes, examine_volumes))
@pytest.mark.tier2
def test_validate_report_after_node_poweroff(self):