summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSri Vignesh <sselvan@redhat.com>2020-05-18 13:11:03 +0530
committerVaibhav Mahajan <vamahaja@redhat.com>2020-05-27 12:40:53 +0000
commitddbf42c510836019e88d15d97519855bdb44deaf (patch)
tree339211f6c0bd85831f100f6ae8397296d411bd24 /tests
parent9ba2ed7d5fbb0f2342b6d549bf62d4d410fbdb3a (diff)
[TestFix] Fix tc to cleanup existing BHV and assertion
Fix consits of - 1. Add steps to check existing BHV and delete in case BV(s) are not exists. 2. Fix assertion to validate 'brickCount' and 'distCont' Change-Id: I25bb9d0767f102ec0344b0486fbf4007daca70a0 Signed-off-by: Sri Vignesh <sselvan@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/heketi/test_volume_creation.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/functional/heketi/test_volume_creation.py b/tests/functional/heketi/test_volume_creation.py
index acedc1b..0af49f9 100644
--- a/tests/functional/heketi/test_volume_creation.py
+++ b/tests/functional/heketi/test_volume_creation.py
@@ -255,8 +255,17 @@ class TestVolumeCreationTestCases(BaseClass):
device.
"""
h_node, h_url = self.heketi_client_node, self.heketi_server_url
- topology = heketi_ops.heketi_topology_info(h_node, h_url, json=True)
+ # Remove existing BHV to calculate freespace
+ bhv_list = heketi_ops.get_block_hosting_volume_list(h_node, h_url)
+ if bhv_list:
+ for bhv in bhv_list:
+ bhv_info = heketi_ops.heketi_volume_info(
+ h_node, h_url, bhv, json=True)
+ if bhv_info['blockinfo'].get('blockvolume') is None:
+ heketi_ops.heketi_volume_delete(h_node, h_url, bhv)
+
+ topology = heketi_ops.heketi_topology_info(h_node, h_url, json=True)
nodes_free_space, nodes_ips = [], []
selected_nodes, selected_devices = [], []
cluster = topology['clusters'][0]
@@ -368,15 +377,15 @@ class TestVolumeCreationTestCases(BaseClass):
# Verify distCount in gluster v info
msg = "Volume %s distCount is %s instead of distCount as 3" % (
- vol_name, gluster_v_info['distCount'])
+ vol_name, int(gluster_v_info['distCount']))
self.assertEqual(
- six.text_type(int(gluster_v_info['brickCount']) / 3),
- gluster_v_info['distCount'])
+ int(gluster_v_info['brickCount']) // 3,
+ int(gluster_v_info['distCount']), msg)
# Verify bricks count in gluster v info
msg = ("Volume %s does not have bricks count multiple of 3. It has %s"
% (vol_name, gluster_v_info['brickCount']))
- self.assertFalse(int(gluster_v_info['brickCount']) % 3)
+ self.assertFalse(int(gluster_v_info['brickCount']) % 3, msg)
@pytest.mark.tier1
def test_create_volume_with_same_name(self):