diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2019-01-03 23:57:12 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2019-01-08 18:02:53 +0530 |
commit | caf9ea1f2f2a25996d5792be680e3f69ed538b7d (patch) | |
tree | e056c40d4bccbe9e26833f97f6e6199db308eeb2 /tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py | |
parent | c3663d0f3445d6fc2e56f767dd1b31c8e94464cb (diff) |
Fix 'test_volume_create_and_list_volume'
This test case expects that Gluster cluster has the same amount of
volumes as Heketi does. But, it is wrong expectation.
We may either create gluster volumes without Heketi or have
mismatches after some other Heketi failures.
So, fix this test case by comparing starting and resulting amount of
volumes in Gluster and Heketi.
Change-Id: I322c922fbdf102ccc5fb9f2145eef7b3f1d1a80a
Diffstat (limited to 'tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py')
-rw-r--r-- | tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py index af9d2b44..e826de4d 100644 --- a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py +++ b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py @@ -28,40 +28,48 @@ class TestHeketiVolume(HeketiBaseClass): @podcmd.GlustoPod() def test_volume_create_and_list_volume(self): - """ - Create a heketi volume and list the volume - compare the volume with gluster volume list - """ + """Make sure that Heketi vol creation creates just one Gluster vol.""" + + g.log.info("List gluster volumes before Heketi volume creation") + existing_g_vol_list = get_volume_list('auto_get_gluster_endpoint') + self.assertTrue(existing_g_vol_list, ("Unable to get volumes list")) + + g.log.info("List heketi volumes before volume creation") + existing_h_vol_list = heketi_volume_list( + self.heketi_client_node, self.heketi_server_url, + json=True)["volumes"] + g.log.info("Heketi volumes successfully listed") + g.log.info("Create a heketi volume") out = heketi_volume_create(self.heketi_client_node, self.heketi_server_url, self.volume_size, json=True) - self.assertTrue(out, ("Failed to create heketi " - "volume of size %s" % self.volume_size)) g.log.info("Heketi volume successfully created" % out) volume_id = out["bricks"][0]["volume"] self.addCleanup(self.delete_volumes, volume_id) - g.log.info("List heketi volumes") - volumes = heketi_volume_list(self.heketi_client_node, - self.heketi_server_url, - json=True) - self.assertTrue(volumes, ("Failed to list heketi volumes")) + g.log.info("List heketi volumes after volume creation") + h_vol_list = heketi_volume_list( + self.heketi_client_node, self.heketi_server_url, + json=True)["volumes"] g.log.info("Heketi volumes successfully listed") - g.log.info("List gluster volumes") - vol_list = get_volume_list('auto_get_gluster_endpoint') - self.assertTrue(vol_list, ("Unable to get volumes list")) + g.log.info("List gluster volumes after Heketi volume creation") + g_vol_list = get_volume_list('auto_get_gluster_endpoint') + self.assertTrue(g_vol_list, ("Unable to get volumes list")) g.log.info("Successfully got the volumes list") - # Check the volume count are equal + # Perform checks self.assertEqual( - len(volumes["volumes"]), len(vol_list), - "Lengths of gluster '%s' and heketi '%s' volume lists are " - "not equal." % (vol_list, volumes) - ) - g.log.info("Heketi volumes list %s and" - " gluster volumes list %s" % (volumes, vol_list)) + len(existing_g_vol_list) + 1, len(g_vol_list), + "Expected creation of only one volume in Gluster creating " + "Heketi volume. Here is lists before and after volume creation: " + "%s \n%s" % (existing_g_vol_list, g_vol_list)) + self.assertEqual( + len(existing_h_vol_list) + 1, len(h_vol_list), + "Expected creation of only one volume in Heketi. Here is lists " + "of Heketi volumes before and after volume creation: %s\n%s" % ( + existing_h_vol_list, h_vol_list)) @podcmd.GlustoPod() def test_create_vol_and_retrieve_vol_info(self): |