diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2018-10-23 00:53:02 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2018-10-23 14:17:23 +0530 |
commit | 8120037a7e5a4cb9298ec59882c4aa10cdbf62ff (patch) | |
tree | 4dea802792074ea9957c75612c965b05409160f6 /tests/functional/common/heketi/heketi_tests | |
parent | e4f40d9d10a40fd0afa892a0d6cdb51eb4f50e09 (diff) |
Fix all existing pep8 errors
Change-Id: I97c949614ca70ea3e732c8c2ca70022d062ad04c
Diffstat (limited to 'tests/functional/common/heketi/heketi_tests')
4 files changed, 48 insertions, 49 deletions
diff --git a/tests/functional/common/heketi/heketi_tests/test_check_entry.py b/tests/functional/common/heketi/heketi_tests/test_check_entry.py index 16fbe085..47a0b3f2 100644 --- a/tests/functional/common/heketi/heketi_tests/test_check_entry.py +++ b/tests/functional/common/heketi/heketi_tests/test_check_entry.py @@ -1,13 +1,12 @@ -#!/usr/bin/python - from glusto.core import Glusto as g from glustolibs.gluster.exceptions import ConfigError + from cnslibs.common.heketi_libs import HeketiClientSetupBaseClass from cnslibs.common.heketi_ops import (heketi_volume_create, heketi_volume_list, heketi_volume_delete) -from cnslibs.common import heketi_ops, podcmd -from cnslibs.common.openshift_ops import oc_rsh, get_ocp_gluster_pod_names +from cnslibs.common.openshift_ops import get_ocp_gluster_pod_names +from cnslibs.common import podcmd class TestHeketiVolume(HeketiClientSetupBaseClass): @@ -51,11 +50,13 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): gluster_pod = get_ocp_gluster_pod_names( self.heketi_client_node)[1] - cmd = "oc rsync "+ gluster_pod +":/var/lib/heketi/fstab /tmp" + cmd = "oc rsync " + gluster_pod + ":/var/lib/heketi/fstab /tmp" out = g.run(self.heketi_client_node, cmd) self.assertTrue(out, ("Failed to copy the file")) g.log.info("Copied the file") - out = g.run_local("scp -r root@" +self.heketi_client_node+":/tmp/fstab /tmp/file.txt") + out = g.run_local( + "scp -r root@%s:/tmp/fstab " + "/tmp/file.txt" % self.heketi_client_node) self.assertTrue(out, ("Failed to copy a file to /tmp/file.txt")) g.log.info("Successfully copied to /tmp/file.txt") out = g.run_local("ls /tmp") @@ -67,7 +68,8 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): # Check if the brick is mounted for i in path: string_to_search = i - rcode, rout, rerr = g.run_local('grep %s %s' % (string_to_search, "/tmp/file.txt")) + rcode, rout, rerr = g.run_local( + 'grep %s %s' % (string_to_search, "/tmp/file.txt")) if rcode == 0: g.log.info("Brick %s is mounted" % i) datafile.close() @@ -99,11 +101,12 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): gluster_pod = get_ocp_gluster_pod_names( self.heketi_client_node)[0] - cmd = "oc rsync "+ gluster_pod +":/var/lib/heketi/fstab /" + cmd = "oc rsync " + gluster_pod + ":/var/lib/heketi/fstab /" out = g.run(self.heketi_client_node, cmd) self.assertTrue(out, ("Failed to copy the file")) g.log.info("Copied the file") - out = g.run_local("scp -r root@" +self.heketi_client_node+":/fstab /tmp/newfile.txt") + out = g.run_local( + "scp -r root@%s:/fstab /tmp/newfile.txt" % self.heketi_client_node) self.assertTrue(out, ("Failed to copy to the file newfile.txt")) g.log.info("Successfully copied to the file newfile.txt") out = g.run_local("ls /tmp") @@ -115,7 +118,8 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): # Check if the brick is mounted for i in path: string_to_search = i - rcode, rout, rerr = g.run_local('grep %s %s' % (string_to_search, "/tmp/newfile.txt")) + rcode, rout, rerr = g.run_local( + 'grep %s %s' % (string_to_search, "/tmp/newfile.txt")) if rcode == 0: raise ConfigError("Particular %s brick entry is found" % i) datafile.close() diff --git a/tests/functional/common/heketi/heketi_tests/test_create_heketi_volume_size_60.py b/tests/functional/common/heketi/heketi_tests/test_create_heketi_volume_size_60.py index d871be30..29b39513 100644 --- a/tests/functional/common/heketi/heketi_tests/test_create_heketi_volume_size_60.py +++ b/tests/functional/common/heketi/heketi_tests/test_create_heketi_volume_size_60.py @@ -1,21 +1,19 @@ -#!/usr/bin/python - from __future__ import division import math from glusto.core import Glusto as g -from glustolibs.gluster.exceptions import ConfigError from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info + +from cnslibs.common.exceptions import ExecutionError from cnslibs.common.heketi_libs import HeketiClientSetupBaseClass from cnslibs.common.heketi_ops import (heketi_node_list, heketi_node_info, heketi_volume_create, heketi_volume_list, heketi_volume_info, - heketi_volume_delete, - heketi_topology_info) -from cnslibs.common import heketi_ops, podcmd -from cnslibs.common.openshift_ops import oc_rsh, get_ocp_gluster_pod_names + heketi_volume_delete) +from cnslibs.common.openshift_ops import get_ocp_gluster_pod_names +from cnslibs.common import podcmd class TestHeketiVolume(HeketiClientSetupBaseClass): @@ -25,7 +23,6 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): Get free space in each devices """ free_spaces = [] - device_list = [] heketi_node_id_list = heketi_node_list( self.heketi_client_node, self.heketi_server_url) for node_id in heketi_node_id_list: @@ -36,10 +33,7 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): for device in node_info_dict["devices"]: total_free_space += device["storage"]["free"] free_spaces.append(total_free_space) - min_free_space = min(free_spaces) total_free_space = sum(free_spaces)/(1024**2) - optimum_space = min_free_space / (1024 * 1024 * 10) - free_space = int(math.floor(optimum_space)) total_free_space = int(math.floor(total_free_space)) return total_free_space, free_spaces @@ -70,7 +64,9 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): mount_node = (out["mount"]["glusterfs"] ["device"].strip().split(":")[0]) hosts.append(mount_node) - backup_volfile_server_list = (out["mount"]["glusterfs"]["options"] ["backup-volfile-servers"].strip().split(",")) + backup_volfile_server_list = ( + out["mount"]["glusterfs"]["options"][ + "backup-volfile-servers"].strip().split(",")) for backup_volfile_server in backup_volfile_server_list: hosts.append(backup_volfile_server) for gluster_server in g.config["gluster_servers"].keys(): @@ -81,9 +77,9 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): # Retrieve heketi volume info g.log.info("Retrieving heketi volume info") - out = heketi_ops.heketi_volume_info(self.heketi_client_node, - self.heketi_server_url, - volume_id, json=True) + out = heketi_volume_info( + self.heketi_client_node, self.heketi_server_url, volume_id, + json=True) self.assertTrue(out, ("Failed to get heketi volume info")) g.log.info("Successfully got the heketi volume info") name = out["name"] @@ -187,9 +183,11 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): # Compare the free size before and after deleting volume g.log.info("Comparing the free space before and after" " deleting volume") - self.assertTrue(free_space_after_creating_vol < free_space_after_deleting_vol) + self.assertTrue( + free_space_after_creating_vol < free_space_after_deleting_vol) g.log.info("Volume successfully deleted and space is" " reallocated. Free space after creating" " volume %s, Free space after deleting" - " volume %s" % ((free_space_after_creating_vol), - (free_space_after_deleting_vol))) + " volume %s" % ( + free_space_after_creating_vol, + free_space_after_deleting_vol)) 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 90ae7b51..c28f455b 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 @@ -1,21 +1,21 @@ -#!/usr/bin/python - from glustolibs.gluster.exceptions import ExecutionError, ConfigError from glusto.core import Glusto as g from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info + from cnslibs.common.heketi_libs import HeketiClientSetupBaseClass from cnslibs.common.heketi_ops import (heketi_volume_create, heketi_volume_list, heketi_volume_info, - heketi_volume_delete, heketi_blockvolume_create, heketi_blockvolume_delete, heketi_cluster_list, heketi_cluster_delete, + heketi_node_info, heketi_node_list, heketi_node_delete) -from cnslibs.common import heketi_ops, podcmd -from cnslibs.common.openshift_ops import oc_rsh, get_ocp_gluster_pod_names +from cnslibs.common.openshift_ops import get_ocp_gluster_pod_names +from cnslibs.common import podcmd + class TestHeketiVolume(HeketiClientSetupBaseClass): """ @@ -41,7 +41,6 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): g.log.info("Heketi volume successfully created" % out) volume_id = out["bricks"][0]["volume"] self.addCleanup(self.delete_volumes, volume_id) - name = out["name"] g.log.info("List heketi volumes") volumes = heketi_volume_list(self.heketi_client_node, @@ -87,9 +86,9 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): self.addCleanup(self.delete_volumes, volume_id) g.log.info("Retrieving heketi volume info") - out = heketi_ops.heketi_volume_info(self.heketi_client_node, - self.heketi_server_url, - volume_id, json=True) + out = heketi_volume_info( + self.heketi_client_node, self.heketi_server_url, volume_id, + json=True) self.assertTrue(out, ("Failed to get heketi volume info")) g.log.info("Successfully got the heketi volume info") name = out["name"] @@ -115,7 +114,7 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): volumes = heketi_volume_list(self.heketi_client_node, self.heketi_server_url, json=True) - if (len(volumes["volumes"])== 0): + if (len(volumes["volumes"]) == 0): g.log.info("Creating heketi volume") out = heketi_volume_create(self.heketi_client_node, self.heketi_server_url, @@ -170,7 +169,7 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): g.log.info("Successfully got the list of nodes") for node_id in heketi_node_id_list: g.log.info("Retrieve the node info") - node_info_dict = heketi_ops.heketi_node_info( + node_info_dict = heketi_node_info( self.heketi_client_node, self.heketi_server_url, node_id, json=True) if not(node_info_dict["devices"][1]["storage"]["used"]): 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 81462906..26ac56f7 100644 --- a/tests/functional/common/heketi/heketi_tests/test_node_info.py +++ b/tests/functional/common/heketi/heketi_tests/test_node_info.py @@ -1,13 +1,10 @@ -#!/usr/bin/python - from glusto.core import Glusto as g from glustolibs.gluster.exceptions import ExecutionError -from glustolibs.gluster.peer_ops import (get_pool_list) +from glustolibs.gluster.peer_ops import get_pool_list + from cnslibs.common.heketi_libs import HeketiClientSetupBaseClass -from cnslibs.common.heketi_ops import (heketi_node_info, - heketi_node_list) from cnslibs.common import heketi_ops, podcmd -from cnslibs.common.openshift_ops import oc_rsh, get_ocp_gluster_pod_names +from cnslibs.common.openshift_ops import get_ocp_gluster_pod_names class TestHeketiVolume(HeketiClientSetupBaseClass): @@ -25,7 +22,7 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): # List all list ip = [] g.log.info("Listing the node id") - heketi_node_id_list = heketi_node_list( + heketi_node_id_list = heketi_ops.heketi_node_list( self.heketi_client_node, self.heketi_server_url) g.log.info("Successfully listed the node") @@ -61,8 +58,9 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): 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))) + 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))) @@ -74,7 +72,7 @@ class TestHeketiVolume(HeketiClientSetupBaseClass): # List all list g.log.info("Listing the node id") - heketi_node_id_list = heketi_node_list( + 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") |