diff options
author | vamahaja <vamahaja@redhat.com> | 2019-09-11 14:46:59 +0530 |
---|---|---|
committer | vponomar <vponomar@redhat.com> | 2019-09-19 11:45:44 +0000 |
commit | a214cf6781d48594afc84d08e865d59bdcbe8fe1 (patch) | |
tree | 484092c4cc0f318871ed4c4299e663edf0b0489e /tests/functional/heketi/test_node_info.py | |
parent | 764d7bd68ec0b4ea9229c381b3b4195367b44b83 (diff) |
Merge heketi node operation tests in one class and fix library
Fix consists of -
- Use "**kwargs" approach in the "heketi_node_list"
function as it is done in lots of other functions.
- Parse the CLI output in the "heketi_node_list" function
using regex instead of the splitting and stripping strings.
- Combine test cases related to the same feature into one
module - test_heketi_node_operations.py
- Remove redundant checks which already exist in common
libraries.
- Remove unnecessary logging.
Change-Id: I815ddfbbacb765140229e7630ec87a6bbaa6255b
Signed-off-by: vamahaja <vamahaja@redhat.com>
Diffstat (limited to 'tests/functional/heketi/test_node_info.py')
-rw-r--r-- | tests/functional/heketi/test_node_info.py | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/functional/heketi/test_node_info.py b/tests/functional/heketi/test_node_info.py deleted file mode 100644 index 5bf7270f..00000000 --- a/tests/functional/heketi/test_node_info.py +++ /dev/null @@ -1,80 +0,0 @@ -from glusto.core import Glusto as g -from glustolibs.gluster.exceptions import ExecutionError -from glustolibs.gluster.peer_ops import get_pool_list - -from openshiftstoragelibs.baseclass import BaseClass -from openshiftstoragelibs import heketi_ops, podcmd - - -class TestHeketiVolume(BaseClass): - """ - Class to test heketi volume create - """ - - @podcmd.GlustoPod() - def test_to_get_list_of_nodes(self): - """ - Listing all nodes and compare the - node listed in previous step - """ - - # List all list - ip = [] - g.log.info("Listing the node id") - heketi_node_id_list = heketi_ops.heketi_node_list( - self.heketi_client_node, self.heketi_server_url) - - g.log.info("Successfully listed the node") - - if (len(heketi_node_id_list) == 0): - raise ExecutionError("Node list empty") - - for node_id in heketi_node_id_list: - g.log.info("Retrieve the node info") - node_info = heketi_ops.heketi_node_info( - self.heketi_client_node, self.heketi_server_url, - node_id, json=True) - self.assertTrue(node_info, ("Failed to " - "retrieve the node info")) - g.log.info("Successfully retrieved the node info %s" % node_id) - ip.append(node_info["hostnames"]["storage"]) - - # Compare the node listed in previous step - hostname = [] - - g.log.info("Get the pool list") - list_of_pools = get_pool_list('auto_get_gluster_endpoint') - self.assertTrue(list_of_pools, ("Failed to get the " - "pool list from gluster pods/nodes")) - g.log.info("Successfully got the pool list from gluster pods/nodes") - for pool in list_of_pools: - hostname.append(pool["hostname"]) - - if (len(heketi_node_id_list) != len(list_of_pools)): - raise ExecutionError( - "Heketi volume list %s is not equal " - "to gluster volume list %s" % ((ip), (hostname))) - g.log.info("The node IP's from node info and list" - " is : %s/n and pool list from gluster" - " pods/nodes is %s" % ((ip), (hostname))) - - def test_to_retrieve_node_info(self): - """ - List and retrieve node related info - """ - - # List all list - g.log.info("Listing the node id") - heketi_node_id_list = heketi_ops.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 node_id in heketi_node_id_list: - g.log.info("Retrieve the node info") - node_info = heketi_ops.heketi_node_info( - self.heketi_client_node, self.heketi_server_url, - node_id, json=True) - self.assertTrue(node_info, ("Failed to " - "retrieve the node info")) - g.log.info("Successfully retrieved the node info %s" % node_id) |