diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-07-19 17:27:42 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2018-07-19 17:36:34 +0530 |
commit | f8508c0cd42d8e1ba18e06d79f9ef515faa36fe2 (patch) | |
tree | 07af46d8cbb5e13ca0c55aa356f81311640cb245 /tests/functional/common/heketi/heketi_tests/test_node_info.py | |
parent | b7f6a80ceb1af26dec130facb64485ded0db18b2 (diff) |
Refactor 'heketi_node_list' function
Do following improvements to this function:
- Remove support of python Heketi client, because it is dead code.
It is dead code, because all of the tests which use this function,
explicitly depend on the CLI output, not being compatible with it.
- Remove useless 'json' arg, as CLI client does not support it for 'node
list' command.
- Parse list of node IDs in it, not delegating this to the consumer.
- Raise exception in case we failed to get list of nodes
And, of course, update all the places where this function is used.
Making those places use less code compared to previous variant.
Change-Id: I3f1ffe6082541e63dc3d638c19c54086aa12580f
Diffstat (limited to 'tests/functional/common/heketi/heketi_tests/test_node_info.py')
-rw-r--r-- | tests/functional/common/heketi/heketi_tests/test_node_info.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/functional/common/heketi/heketi_tests/test_node_info.py b/tests/functional/common/heketi/heketi_tests/test_node_info.py index 94ac34b9..81462906 100644 --- a/tests/functional/common/heketi/heketi_tests/test_node_info.py +++ b/tests/functional/common/heketi/heketi_tests/test_node_info.py @@ -23,16 +23,12 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): """ # List all list - heketi_node_id_list = [] ip = [] g.log.info("Listing the node id") - node_list = heketi_node_list(self.heketi_client_node, - self.heketi_server_url) - self.assertTrue(node_list, ("Failed to list heketi nodes")) + heketi_node_id_list = heketi_node_list( + self.heketi_client_node, self.heketi_server_url) + g.log.info("Successfully listed the node") - for line in node_list.strip().split("\n"): - heketi_node_id_list.append(line.strip().split( - "Cluster")[0].strip().split(":")[1]) if (len(heketi_node_id_list) == 0): raise ExecutionError("Node list empty") @@ -77,15 +73,11 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): """ # List all list - heketi_node_id_list = [] g.log.info("Listing the node id") - node_list = heketi_node_list(self.heketi_client_node, - self.heketi_server_url) - self.assertTrue(node_list, ("Failed to list heketi nodes")) + heketi_node_id_list = heketi_node_list( + self.heketi_client_node, self.heketi_server_url) + self.assertTrue(heketi_node_id_list, ("Node Id list is empty.")) g.log.info("Successfully listed the node") - for line in node_list.strip().split("\n"): - heketi_node_id_list.append(line.strip().split( - "Cluster")[0].strip().split(":")[1]) for node_id in heketi_node_id_list: g.log.info("Retrieve the node info") |