diff options
Diffstat (limited to 'tests/functional/common')
3 files changed, 56 insertions, 28 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): diff --git a/tests/functional/common/heketi/test_heketi_device_operations.py b/tests/functional/common/heketi/test_heketi_device_operations.py index 3fa90bc3..1c4b5457 100644 --- a/tests/functional/common/heketi/test_heketi_device_operations.py +++ b/tests/functional/common/heketi/test_heketi_device_operations.py @@ -178,8 +178,12 @@ class TestHeketiDeviceOperations(HeketiBaseClass): gluster_server_0 = g.config["gluster_servers"].values()[0] try: device_name = gluster_server_0["additional_devices"][0] - except IndexError: - self.skipTest("Additional disk is not specified for node.") + except (KeyError, IndexError): + self.skipTest( + "Additional disk is not specified for node with following " + "hostnames and IP addresses: %s, %s." % ( + gluster_server_0.get('manage', '?'), + gluster_server_0.get('storage', '?'))) manage_hostname = gluster_server_0["manage"] # Get node ID of the Gluster hostname diff --git a/tests/functional/common/heketi/test_volume_expansion_and_devices.py b/tests/functional/common/heketi/test_volume_expansion_and_devices.py index 05f39700..90574f61 100644 --- a/tests/functional/common/heketi/test_volume_expansion_and_devices.py +++ b/tests/functional/common/heketi/test_volume_expansion_and_devices.py @@ -320,6 +320,7 @@ class TestVolumeExpansionAndDevicesTestCases(HeketiBaseClass): # Prepare first 3 nodes smallest_size = None + err_msg = '' for node_id in heketi_node_id_list[0:3]: node_info = heketi_ops.heketi_node_info( h_node, h_server_url, node_id, json=True) @@ -341,6 +342,7 @@ class TestVolumeExpansionAndDevicesTestCases(HeketiBaseClass): h_node, h_server_url, device["id"]) # Gather info about additional devices + additional_device_name = None for gluster_server in self.gluster_servers: gluster_server_data = self.gluster_servers_info[gluster_server] g_manage = gluster_server_data["manage"] @@ -348,12 +350,23 @@ class TestVolumeExpansionAndDevicesTestCases(HeketiBaseClass): if not (g_manage in node_info["hostnames"]["manage"] or g_storage in node_info["hostnames"]["storage"]): continue + additional_device_name = (( + gluster_server_data.get("additional_devices") or [''])[0]) + break + + if not additional_device_name: + err_msg += ("No 'additional_devices' are configured for " + "'%s' node, which has following hostnames and " + "IP addresses: %s.\n" % ( + node_id, + ', '.join(node_info["hostnames"]["manage"] + + node_info["hostnames"]["storage"]))) + continue - heketi_ops.heketi_device_add( - h_node, h_server_url, - gluster_server_data["additional_devices"][0], node_id) - additional_devices_attached.update( - {node_id: gluster_server_data["additional_devices"][0]}) + heketi_ops.heketi_device_add( + h_node, h_server_url, additional_device_name, node_id) + additional_devices_attached.update( + {node_id: additional_device_name}) # Schedule cleanup of the added devices for node_id in additional_devices_attached.keys(): @@ -368,6 +381,9 @@ class TestVolumeExpansionAndDevicesTestCases(HeketiBaseClass): self.fail("Could not find ID for added device on " "'%s' node." % node_id) + if err_msg: + self.skipTest(err_msg) + # Temporary disable new devices self.disable_devices(additional_devices_attached) |