summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-01-02 20:51:13 +0530
committerValerii Ponomarov <vponomar@redhat.com>2019-01-02 20:51:13 +0530
commit874dd8ccabd32bcf2d4cfb4a0be10db7ba1a565d (patch)
tree55a0c6be589a4571c96528a2c56b269b0bfaabf6 /tests
parentcf2474da1063a24bdd4548b95b8b548e5ef1d03a (diff)
Properly skip TCs when 'additional gluster devices' not configured
For the moment, we have 3 different test cases which use 'additional_devices' config option. All of them will fail in case of specific structure of config. So, make those test cases be smart enough to understand absence of such option data and skip test cases with useful info about it. Change-Id: Id31de7e20188041d2148edf37b3f8c95645c5e52
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/common/heketi/test_heketi_device_operations.py8
-rw-r--r--tests/functional/common/heketi/test_volume_expansion_and_devices.py26
2 files changed, 27 insertions, 7 deletions
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)