From 902dc78766d0938f0e40c71c25a4ce2bb10b005d Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Fri, 13 Dec 2019 20:05:55 +0530 Subject: [py2to3] Add py3 support in 'tests/functional/glusterd'. Part 1 Change-Id: Ib414b8496ca65a48bbe42936e32a863c9c1072e4 Signed-off-by: Valerii Ponomarov --- .../glusterd/test_add_brick_when_quorum_not_met.py | 2 +- .../glusterd/test_add_identical_brick_new_node.py | 4 ++-- tests/functional/glusterd/test_brick_log_messages.py | 13 ++++++++----- ...st_brick_port_after_stop_glusterd_modify_volume.py | 4 ++-- .../glusterd/test_brick_status_when_quorum_not_met.py | 4 ++-- .../functional/glusterd/test_change_reserve_limit.py | 17 +++++++++++------ tests/functional/glusterd/test_concurrent_set.py | 4 ++-- .../glusterd/test_create_vol_with_used_bricks.py | 12 ++++++++---- .../glusterd/test_detach_node_used_to_mount.py | 4 ++-- ...t_enable_brickmux_create_and_stop_three_volumes.py | 2 +- .../glusterd/test_enabling_glusterd_debug_mode.py | 4 ++-- .../glusterd/test_glusterd_logs_when_peer_detach.py | 2 +- tests/functional/glusterd/test_glusterd_quorum.py | 4 ++-- .../glusterd/test_glusterd_replace_brick.py | 4 ++-- .../test_glusterd_snap_info_on_detached_node.py | 2 +- .../functional/glusterd/test_glusterd_split_brain.py | 4 ++-- .../glusterd/test_host_uuid_in_volume_info_xml.py | 4 ++-- .../glusterd/test_lower_gluster_op_version.py | 4 ++-- .../test_mount_after_removing_client_logs_dir.py | 4 ++-- tests/functional/glusterd/test_nfs_quorum.py | 6 +++--- tests/functional/glusterd/test_op_version.py | 4 ++-- .../glusterd/test_ops_when_one_node_is_down.py | 4 ++-- tests/functional/glusterd/test_peer_detach.py | 2 +- .../test_peer_detach_check_warning_message.py | 2 +- tests/functional/glusterd/test_peer_probe.py | 4 ++-- .../test_peer_probe_after_setting_global_options.py | 4 ++-- .../glusterd/test_peer_probe_while_snapd_running.py | 2 +- tests/functional/glusterd/test_probe_glusterd.py | 18 ------------------ tests/functional/glusterd/test_probe_hostname.py | 4 ++-- tests/functional/glusterd/test_profile_operations.py | 18 ++++++++++-------- .../test_profile_operations_with_one_node_down.py | 19 +++++++++++-------- .../test_profile_start_with_quorum_not_met.py | 4 ++-- 32 files changed, 94 insertions(+), 95 deletions(-) (limited to 'tests/functional') diff --git a/tests/functional/glusterd/test_add_brick_when_quorum_not_met.py b/tests/functional/glusterd/test_add_brick_when_quorum_not_met.py index 1e4c782b3..0961decf6 100644 --- a/tests/functional/glusterd/test_add_brick_when_quorum_not_met.py +++ b/tests/functional/glusterd/test_add_brick_when_quorum_not_met.py @@ -78,7 +78,7 @@ class TestAddBrickWhenQuorumNotMet(GlusterBaseClass): g.log.info("Able to set server quorum ratio successfully on %s", self.servers) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_add_brick_when_quorum_not_met(self): diff --git a/tests/functional/glusterd/test_add_identical_brick_new_node.py b/tests/functional/glusterd/test_add_identical_brick_new_node.py index 240436d88..ce643fbae 100644 --- a/tests/functional/glusterd/test_add_identical_brick_new_node.py +++ b/tests/functional/glusterd/test_add_identical_brick_new_node.py @@ -41,7 +41,7 @@ class TestAddIdenticalBrick(GlusterBaseClass): if ret != 0: raise ExecutionError("Peer detach failed") g.log.info("Peer detach SUCCESSFUL.") - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): """ @@ -65,7 +65,7 @@ class TestAddIdenticalBrick(GlusterBaseClass): "servers %s" % self.servers) g.log.info("Peer probe success for detached " "servers %s", self.servers) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_add_identical_brick(self): """ diff --git a/tests/functional/glusterd/test_brick_log_messages.py b/tests/functional/glusterd/test_brick_log_messages.py index d1f8f2fb5..3469151c0 100644 --- a/tests/functional/glusterd/test_brick_log_messages.py +++ b/tests/functional/glusterd/test_brick_log_messages.py @@ -19,8 +19,10 @@ from mountpoint """ +import sys from glusto.core import Glusto as g + from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.brick_libs import get_all_bricks @@ -35,7 +37,7 @@ class TestAddBrickFunctionality(GlusterBaseClass): @classmethod def setUpClass(cls): cls.counter = 1 - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Uploading file_dir script in all client direcotries g.log.info("Upload io scripts to clients %s for running IO on " @@ -56,7 +58,7 @@ class TestAddBrickFunctionality(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume ret = self.setup_volume_and_mount_volume(self.mounts) @@ -78,7 +80,7 @@ class TestAddBrickFunctionality(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_brick_log_messages(self): ''' @@ -103,12 +105,13 @@ class TestAddBrickFunctionality(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 3 " - "--num-of-files 10 %s" % (self.script_upload_path, + "--num-of-files 10 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) diff --git a/tests/functional/glusterd/test_brick_port_after_stop_glusterd_modify_volume.py b/tests/functional/glusterd/test_brick_port_after_stop_glusterd_modify_volume.py index e44514aff..a041f676a 100644 --- a/tests/functional/glusterd/test_brick_port_after_stop_glusterd_modify_volume.py +++ b/tests/functional/glusterd/test_brick_port_after_stop_glusterd_modify_volume.py @@ -44,7 +44,7 @@ class TestBrickPortAfterModifyVolume(GlusterBaseClass): raise ExecutionError("Failed to probe detached " "servers %s" % self.servers) g.log.info("Peer detach SUCCESSFUL.") - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): """ @@ -68,7 +68,7 @@ class TestBrickPortAfterModifyVolume(GlusterBaseClass): "servers %s" % self.servers) g.log.info("Peer probe success for detached " "servers %s", self.servers) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_brick_port(self): # pylint: disable=too-many-statements, too-many-branches diff --git a/tests/functional/glusterd/test_brick_status_when_quorum_not_met.py b/tests/functional/glusterd/test_brick_status_when_quorum_not_met.py index b52bd0beb..71209c2e5 100644 --- a/tests/functional/glusterd/test_brick_status_when_quorum_not_met.py +++ b/tests/functional/glusterd/test_brick_status_when_quorum_not_met.py @@ -38,7 +38,7 @@ class TestBrickStatusWhenQuorumNotMet(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume ret = self.setup_volume() @@ -83,7 +83,7 @@ class TestBrickStatusWhenQuorumNotMet(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_remove_brick_status(self): ''' diff --git a/tests/functional/glusterd/test_change_reserve_limit.py b/tests/functional/glusterd/test_change_reserve_limit.py index 07aea98ae..f047f8b20 100644 --- a/tests/functional/glusterd/test_change_reserve_limit.py +++ b/tests/functional/glusterd/test_change_reserve_limit.py @@ -14,7 +14,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.exceptions import ExecutionError from glustolibs.misc.misc_libs import upload_scripts @@ -33,7 +36,7 @@ class TestChangeReservcelimit(GlusterBaseClass): @classmethod def setUpClass(cls): cls.counter = 1 - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Uploading file_dir script in all client direcotries g.log.info("Upload io scripts to clients %s for running IO on " @@ -91,7 +94,7 @@ class TestChangeReservcelimit(GlusterBaseClass): raise ExecutionError("Failed to delete the brick " "dir's of deleted volume") - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_change_reserve_limit_to_lower_value(self): @@ -134,12 +137,13 @@ class TestChangeReservcelimit(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 3 " - "--num-of-files 10 %s" % (self.script_upload_path, + "--num-of-files 10 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) @@ -222,12 +226,13 @@ class TestChangeReservcelimit(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 3 " - "--num-of-files 10 %s" % (self.script_upload_path, + "--num-of-files 10 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) diff --git a/tests/functional/glusterd/test_concurrent_set.py b/tests/functional/glusterd/test_concurrent_set.py index 4b432b784..72b8a1509 100644 --- a/tests/functional/glusterd/test_concurrent_set.py +++ b/tests/functional/glusterd/test_concurrent_set.py @@ -28,7 +28,7 @@ from glustolibs.gluster.lib_utils import (form_bricks_list, class TestConcurrentSet(GlusterBaseClass): @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() g.log.info("Starting %s ", cls.__name__) ret = cls.validate_peers_are_connected() if not ret: @@ -44,7 +44,7 @@ class TestConcurrentSet(GlusterBaseClass): self.assertTrue(ret, "Failed to Cleanup the Volume %s" % volume) g.log.info("Volume deleted successfully : %s", volume) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_concurrent_set(self): # time stamp of current test case diff --git a/tests/functional/glusterd/test_create_vol_with_used_bricks.py b/tests/functional/glusterd/test_create_vol_with_used_bricks.py index e37741d56..62b08a0c7 100644 --- a/tests/functional/glusterd/test_create_vol_with_used_bricks.py +++ b/tests/functional/glusterd/test_create_vol_with_used_bricks.py @@ -18,7 +18,10 @@ Create volume using bricks of deleted volume """ +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.brick_ops import add_brick @@ -37,7 +40,7 @@ class TestCreateVolWithUsedBricks(GlusterBaseClass): @classmethod def setUpClass(cls): cls.counter = 1 - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Uploading file_dir script in all client direcotries g.log.info("Upload io scripts to clients %s for running IO on " @@ -78,7 +81,7 @@ class TestCreateVolWithUsedBricks(GlusterBaseClass): "dir's of deleted volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_create_vol_used_bricks(self): ''' @@ -120,12 +123,13 @@ class TestCreateVolWithUsedBricks(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dirname-start-num %d " "--dir-depth 2 " "--dir-length 5 " "--max-num-of-dirs 3 " - "--num-of-files 10 %s" % (self.script_upload_path, + "--num-of-files 10 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) diff --git a/tests/functional/glusterd/test_detach_node_used_to_mount.py b/tests/functional/glusterd/test_detach_node_used_to_mount.py index e5b2a70c1..b45d7c1de 100644 --- a/tests/functional/glusterd/test_detach_node_used_to_mount.py +++ b/tests/functional/glusterd/test_detach_node_used_to_mount.py @@ -39,7 +39,7 @@ class TestChangeReservcelimit(GlusterBaseClass): @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes setup cls.volume['voltype'] = { @@ -85,7 +85,7 @@ class TestChangeReservcelimit(GlusterBaseClass): if not ret: raise ExecutionError("Unable to delete volume %s" % self.volname) g.log.info("Volume deleted successfully %s", self.volname) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_detach_node_used_to_mount(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_enable_brickmux_create_and_stop_three_volumes.py b/tests/functional/glusterd/test_enable_brickmux_create_and_stop_three_volumes.py index 9ae673100..40b2a19f0 100644 --- a/tests/functional/glusterd/test_enable_brickmux_create_and_stop_three_volumes.py +++ b/tests/functional/glusterd/test_enable_brickmux_create_and_stop_three_volumes.py @@ -56,7 +56,7 @@ class TestEnableBrickMuxCreateAndStopThreevolumes(GlusterBaseClass): raise ExecutionError("Failed to disable cluster.brick-multiplex") g.log.info("Successfully set cluster.brick-multiplex to disable.") - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_enable_brickmux_create_and_stop_three_volumes(self): diff --git a/tests/functional/glusterd/test_enabling_glusterd_debug_mode.py b/tests/functional/glusterd/test_enabling_glusterd_debug_mode.py index 8c5bf976a..7e431ba69 100644 --- a/tests/functional/glusterd/test_enabling_glusterd_debug_mode.py +++ b/tests/functional/glusterd/test_enabling_glusterd_debug_mode.py @@ -31,7 +31,7 @@ class TestVolumeOptionSetWithMaxcharacters(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # check whether peers are in connected state ret = self.validate_peers_are_connected() @@ -111,7 +111,7 @@ class TestVolumeOptionSetWithMaxcharacters(GlusterBaseClass): raise ExecutionError("Peers are not in connected state.") g.log.info("Peers are in connected state.") - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_enabling_gluster_debug_mode(self): diff --git a/tests/functional/glusterd/test_glusterd_logs_when_peer_detach.py b/tests/functional/glusterd/test_glusterd_logs_when_peer_detach.py index ed8ba0385..1275ad73a 100644 --- a/tests/functional/glusterd/test_glusterd_logs_when_peer_detach.py +++ b/tests/functional/glusterd/test_glusterd_logs_when_peer_detach.py @@ -40,7 +40,7 @@ class GlusterdLogsWhilePeerDetach(GlusterBaseClass): g.log.info("peer probe is successful for %s", self.random_server) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_logs_while_peer_detach(self): ''' diff --git a/tests/functional/glusterd/test_glusterd_quorum.py b/tests/functional/glusterd/test_glusterd_quorum.py index e60397cd3..16691ce2f 100644 --- a/tests/functional/glusterd/test_glusterd_quorum.py +++ b/tests/functional/glusterd/test_glusterd_quorum.py @@ -37,7 +37,7 @@ class TestServerQuorum(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() ret = volume_exists(cls.mnode, cls.volname) if ret: ret = cleanup_volume(cls.mnode, cls.volname) @@ -90,7 +90,7 @@ class TestServerQuorum(GlusterBaseClass): "Peer probe failed to one of the node") g.log.info("Peer probe successful") - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() @pytest.mark.test_glusterd_quorum_validation def test_glusterd_quorum_validation(self): diff --git a/tests/functional/glusterd/test_glusterd_replace_brick.py b/tests/functional/glusterd/test_glusterd_replace_brick.py index eec182f55..ec415049d 100644 --- a/tests/functional/glusterd/test_glusterd_replace_brick.py +++ b/tests/functional/glusterd/test_glusterd_replace_brick.py @@ -31,7 +31,7 @@ from glustolibs.gluster.brick_libs import are_bricks_online 'distributed-dispersed'], ['glusterfs']]) class TestReplaceBrick(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.test_method_complete = False # Creating a volume and starting it ret = setup_volume(self.mnode, self.all_servers_info, self.volume) @@ -40,7 +40,7 @@ class TestReplaceBrick(GlusterBaseClass): g.log.info("Volume created successfully") def tearDown(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'tearDown')() self.test_method_complete = False ret = self.cleanup_volume() if not ret: diff --git a/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py b/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py index 8c0f7a7f2..643129b1c 100644 --- a/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py +++ b/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py @@ -37,7 +37,7 @@ class TestSnapInfoOnPeerDetachedNode(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_snap_info_from_detached_node(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_glusterd_split_brain.py b/tests/functional/glusterd/test_glusterd_split_brain.py index ad3d05213..ca60398bb 100644 --- a/tests/functional/glusterd/test_glusterd_split_brain.py +++ b/tests/functional/glusterd/test_glusterd_split_brain.py @@ -32,7 +32,7 @@ from glustolibs.gluster.gluster_init import (is_glusterd_running, class GlusterdSplitBrainQuorumValidation(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Overriding the volume type to specifically test the volume type if self.volume_type == "distributed-replicated": @@ -58,7 +58,7 @@ class GlusterdSplitBrainQuorumValidation(GlusterBaseClass): def tearDown(self): # stopping the volume and Cleaning up the volume - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() vol_list = get_volume_list(self.mnode) if vol_list is None: raise ExecutionError("Failed to get the volume list") diff --git a/tests/functional/glusterd/test_host_uuid_in_volume_info_xml.py b/tests/functional/glusterd/test_host_uuid_in_volume_info_xml.py index b5ed75e16..7b7ae20e6 100644 --- a/tests/functional/glusterd/test_host_uuid_in_volume_info_xml.py +++ b/tests/functional/glusterd/test_host_uuid_in_volume_info_xml.py @@ -29,7 +29,7 @@ class TestUUID(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # check whether peers are in connected state ret = self.validate_peers_are_connected() @@ -60,7 +60,7 @@ class TestUUID(GlusterBaseClass): if not ret: raise ExecutionError("Failed to probe detached " "servers %s" % self.servers) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_uuid_in_volume_info_xml(self): diff --git a/tests/functional/glusterd/test_lower_gluster_op_version.py b/tests/functional/glusterd/test_lower_gluster_op_version.py index cfd2c00fa..e3e7bc245 100644 --- a/tests/functional/glusterd/test_lower_gluster_op_version.py +++ b/tests/functional/glusterd/test_lower_gluster_op_version.py @@ -32,7 +32,7 @@ class LowerGlusterOpVersion(GlusterBaseClass): def setUp(self): # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume g.log.info("Started creating volume") ret = self.setup_volume() @@ -43,7 +43,7 @@ class LowerGlusterOpVersion(GlusterBaseClass): def tearDown(self): # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() # stopping the volume and Cleaning up the volume ret = cleanup_volume(self.mnode, self.volname) if not ret: diff --git a/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py b/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py index 491e9abd5..c141b9628 100644 --- a/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py +++ b/tests/functional/glusterd/test_mount_after_removing_client_logs_dir.py @@ -30,7 +30,7 @@ from glustolibs.gluster.mount_ops import mount_volume, umount_volume class TestRemoveCientLogDirAndMount(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume and mounting volume. ret = self.setup_volume(self.mounts) @@ -75,7 +75,7 @@ class TestRemoveCientLogDirAndMount(GlusterBaseClass): % self.volname) g.log.info("Volume deleted successfully : %s", self.volname) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_mount_after_removing_client_logs_dir(self): diff --git a/tests/functional/glusterd/test_nfs_quorum.py b/tests/functional/glusterd/test_nfs_quorum.py index 62d2ce24a..62885198b 100644 --- a/tests/functional/glusterd/test_nfs_quorum.py +++ b/tests/functional/glusterd/test_nfs_quorum.py @@ -31,7 +31,7 @@ class TestNfsMountAndServerQuorumSettings(GlusterBaseClass): @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() g.log.info("Starting %s ", cls.__name__) # checking for peer status from every node @@ -44,7 +44,7 @@ class TestNfsMountAndServerQuorumSettings(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume g.log.info("Started creating volume") @@ -64,7 +64,7 @@ class TestNfsMountAndServerQuorumSettings(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_nfs_mount_quorum_settings(self): """ diff --git a/tests/functional/glusterd/test_op_version.py b/tests/functional/glusterd/test_op_version.py index 0b0cf5b7f..7e6d99466 100644 --- a/tests/functional/glusterd/test_op_version.py +++ b/tests/functional/glusterd/test_op_version.py @@ -34,7 +34,7 @@ class TestMaxSupportedOpVersion(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume g.log.info("Started creating volume") @@ -52,7 +52,7 @@ class TestMaxSupportedOpVersion(GlusterBaseClass): raise ExecutionError("Failed Cleanup the Volume %s" % self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_op_version(self): ''' diff --git a/tests/functional/glusterd/test_ops_when_one_node_is_down.py b/tests/functional/glusterd/test_ops_when_one_node_is_down.py index a18f572b0..5b1ea7809 100644 --- a/tests/functional/glusterd/test_ops_when_one_node_is_down.py +++ b/tests/functional/glusterd/test_ops_when_one_node_is_down.py @@ -30,7 +30,7 @@ class TestOpsWhenOneNodeIsDown(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Create and start a volume. ret = setup_volume(self.mnode, self.all_servers_info, self.volume) @@ -63,7 +63,7 @@ class TestOpsWhenOneNodeIsDown(GlusterBaseClass): raise ExecutionError("Unable to delete volume % s" % self.volname) g.log.info("Volume deleted successfully : %s", self.volname) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_ops_when_one_node_is_down(self): diff --git a/tests/functional/glusterd/test_peer_detach.py b/tests/functional/glusterd/test_peer_detach.py index db58607b8..8b6077b60 100644 --- a/tests/functional/glusterd/test_peer_detach.py +++ b/tests/functional/glusterd/test_peer_detach.py @@ -33,7 +33,7 @@ class PeerDetachVerification(GlusterBaseClass): """ @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # checking for peer status from every node ret = cls.validate_peers_are_connected() diff --git a/tests/functional/glusterd/test_peer_detach_check_warning_message.py b/tests/functional/glusterd/test_peer_detach_check_warning_message.py index 4469aa17f..96606e083 100644 --- a/tests/functional/glusterd/test_peer_detach_check_warning_message.py +++ b/tests/functional/glusterd/test_peer_detach_check_warning_message.py @@ -31,7 +31,7 @@ class TestPeerDetachWarningMessage(GlusterBaseClass): raise ExecutionError("Failed to detach %s" % self.servers[1]) g.log.info("Peer detach successful %s", self.servers[1]) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_peer_detach_check_warning_message(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_peer_probe.py b/tests/functional/glusterd/test_peer_probe.py index 1db7b352e..3a1d01806 100644 --- a/tests/functional/glusterd/test_peer_probe.py +++ b/tests/functional/glusterd/test_peer_probe.py @@ -40,7 +40,7 @@ class TestPeerProbe(GlusterBaseClass): if ret != 0: raise ExecutionError("Peer detach failed") g.log.info("Peer detach SUCCESSFUL.") - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): """ @@ -64,7 +64,7 @@ class TestPeerProbe(GlusterBaseClass): "servers %s" % self.servers) g.log.info("Peer probe success for detached " "servers %s", self.servers) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_peer_probe(self): """ diff --git a/tests/functional/glusterd/test_peer_probe_after_setting_global_options.py b/tests/functional/glusterd/test_peer_probe_after_setting_global_options.py index f9083b7bb..6d3259dc9 100644 --- a/tests/functional/glusterd/test_peer_probe_after_setting_global_options.py +++ b/tests/functional/glusterd/test_peer_probe_after_setting_global_options.py @@ -34,7 +34,7 @@ class TestPeerProbeAfterSettingGlobalOptions(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume ret = self.setup_volume() @@ -57,7 +57,7 @@ class TestPeerProbeAfterSettingGlobalOptions(GlusterBaseClass): raise ExecutionError("Failed Cleanup the Volume %s" % self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_peer_probe_global_options(self): ''' diff --git a/tests/functional/glusterd/test_peer_probe_while_snapd_running.py b/tests/functional/glusterd/test_peer_probe_while_snapd_running.py index aff015638..9e059b033 100644 --- a/tests/functional/glusterd/test_peer_probe_while_snapd_running.py +++ b/tests/functional/glusterd/test_peer_probe_while_snapd_running.py @@ -50,7 +50,7 @@ class TestPeerProbeWhileSnapdRunning(GlusterBaseClass): raise ExecutionError("Failed to probe detached servers %s" % self.servers) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_peer_probe_snapd_running(self): diff --git a/tests/functional/glusterd/test_probe_glusterd.py b/tests/functional/glusterd/test_probe_glusterd.py index 54b99eec2..7403727e3 100644 --- a/tests/functional/glusterd/test_probe_glusterd.py +++ b/tests/functional/glusterd/test_probe_glusterd.py @@ -26,24 +26,6 @@ from glustolibs.gluster.gluster_init import is_glusterd_running class PeerProbeInvalidIpNonExistingHost(GlusterBaseClass): - @classmethod - def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) - g.log.info("Starting %s ", cls.__name__) - - def setUp(self): - """ - setUp method for every test - """ - # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) - - def tearDown(self): - """ - tearDown for every test - """ - # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) def test_peer_probe_invalid_ip_nonexist_host_nonexist_ip(self): ''' diff --git a/tests/functional/glusterd/test_probe_hostname.py b/tests/functional/glusterd/test_probe_hostname.py index fde3557bb..12a30ff67 100644 --- a/tests/functional/glusterd/test_probe_hostname.py +++ b/tests/functional/glusterd/test_probe_hostname.py @@ -39,7 +39,7 @@ class TestPeerProbe(GlusterBaseClass): raise ExecutionError("Peer detach failed") g.log.info("Peer detach SUCCESSFUL.") - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): @@ -64,7 +64,7 @@ class TestPeerProbe(GlusterBaseClass): "servers %s", self.servers) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_peer_probe_validation(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_profile_operations.py b/tests/functional/glusterd/test_profile_operations.py index ae0a968eb..038f6ed87 100644 --- a/tests/functional/glusterd/test_profile_operations.py +++ b/tests/functional/glusterd/test_profile_operations.py @@ -19,7 +19,10 @@ Tests to check basic profile operations. """ +import sys + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.profile_ops import (profile_start, profile_info, @@ -40,7 +43,7 @@ class TestProfileOpeartions(GlusterBaseClass): @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Uploading file_dir script in all client direcotries g.log.info("Upload io scripts to clients %s for running IO on " @@ -57,8 +60,7 @@ class TestProfileOpeartions(GlusterBaseClass): cls.clients) def setUp(self): - - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume and mounting volume. ret = self.setup_volume_and_mount_volume(self.mounts) if not ret: @@ -85,7 +87,7 @@ class TestProfileOpeartions(GlusterBaseClass): raise ExecutionError("Unable to delete volume % s" % volume) g.log.info("Volume deleted successfully : %s", volume) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_profile_operations(self): @@ -113,14 +115,14 @@ class TestProfileOpeartions(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dir-depth 4 " "--dir-length 6 " "--dirname-start-num %d " "--max-num-of-dirs 3 " - "--num-of-files 5 %s" - % (self.script_upload_path, counter, - mount_obj.mountpoint)) + "--num-of-files 5 %s" % ( + sys.version_info.major, self.script_upload_path, + counter, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) diff --git a/tests/functional/glusterd/test_profile_operations_with_one_node_down.py b/tests/functional/glusterd/test_profile_operations_with_one_node_down.py index 762d7cea5..7b7e0409e 100644 --- a/tests/functional/glusterd/test_profile_operations_with_one_node_down.py +++ b/tests/functional/glusterd/test_profile_operations_with_one_node_down.py @@ -19,9 +19,12 @@ Tests to check basic profile operations with one node down. """ -from time import sleep from random import randint +import sys +from time import sleep + from glusto.core import Glusto as g + from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.exceptions import ExecutionError from glustolibs.gluster.profile_ops import (profile_start, profile_info, @@ -40,7 +43,7 @@ class TestProfileOpeartionsWithOneNodeDown(GlusterBaseClass): @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Uploading file_dir script in all client direcotries g.log.info("Upload io scripts to clients %s for running IO on " @@ -58,7 +61,7 @@ class TestProfileOpeartionsWithOneNodeDown(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume and mounting volume. ret = self.setup_volume_and_mount_volume(self.mounts) if not ret: @@ -93,7 +96,7 @@ class TestProfileOpeartionsWithOneNodeDown(GlusterBaseClass): raise ExecutionError("Unable to delete volume % s" % self.volname) g.log.info("Volume deleted successfully : %s", self.volname) - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_profile_operations_with_one_node_down(self): @@ -116,14 +119,14 @@ class TestProfileOpeartionsWithOneNodeDown(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Starting IO on %s:%s", mount_obj.client_system, mount_obj.mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dir-depth 4 " "--dirname-start-num %d " "--dir-length 6 " "--max-num-of-dirs 3 " - "--num-of-files 5 %s" - % (self.script_upload_path, counter, - mount_obj.mountpoint)) + "--num-of-files 5 %s" % ( + sys.version_info.major, self.script_upload_path, + counter, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, user=mount_obj.user) self.all_mounts_procs.append(proc) diff --git a/tests/functional/glusterd/test_profile_start_with_quorum_not_met.py b/tests/functional/glusterd/test_profile_start_with_quorum_not_met.py index 7fffac89b..7bb434fe3 100644 --- a/tests/functional/glusterd/test_profile_start_with_quorum_not_met.py +++ b/tests/functional/glusterd/test_profile_start_with_quorum_not_met.py @@ -31,7 +31,7 @@ class TestProfileStartWithQuorumNotMet(GlusterBaseClass): def setUp(self): # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Creating Volume g.log.info("Started creating volume") @@ -59,7 +59,7 @@ class TestProfileStartWithQuorumNotMet(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_profile_start_with_quorum_not_met(self): # pylint: disable=too-many-statements -- cgit