From 6a17654e9be3d5fbae9fa25249a7e2c8d892df3a Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Fri, 13 Dec 2019 21:19:07 +0530 Subject: [py2to3] Add py3 support in 'tests/functional/glusterd'. Part 2 Change-Id: I1395e14d8d0aa0cc6097e51c64262fb481f36f05 Signed-off-by: Valerii Ponomarov --- .../glusterd/test_quorum_remove_brick.py | 4 +- tests/functional/glusterd/test_quorum_syslog.py | 7 ++-- .../glusterd/test_readonly_option_on_volume.py | 17 ++++++--- tests/functional/glusterd/test_rebalance_hang.py | 4 +- .../functional/glusterd/test_rebalance_new_node.py | 19 ++++------ .../functional/glusterd/test_rebalance_spurious.py | 4 +- .../glusterd/test_rebalance_when_quorum_not_met.py | 4 +- .../test_remove_brick_after_restart_glusterd.py | 4 +- .../glusterd/test_remove_brick_scenarios.py | 6 +-- .../test_remove_brick_when_quorum_not_met.py | 5 +-- .../glusterd/test_replace_brick_quorum_not_met.py | 2 +- .../test_restart_glusterd_while_rebalancing.py | 12 ++++-- .../test_self_heal_quota_daemon_after_reboot.py | 44 +++++++++++----------- ...lume_option_when_one_node_is_down_in_cluster.py | 5 +-- ...volume_option_with_more_than_4096_characters.py | 5 +-- tests/functional/glusterd/test_shared_storage.py | 4 +- .../glusterd/test_status_string_in_volstatus.py | 4 +- tests/functional/glusterd/test_volume_create.py | 4 +- .../test_volume_create_with_glusterd_restarts.py | 2 +- tests/functional/glusterd/test_volume_delete.py | 6 +-- tests/functional/glusterd/test_volume_get.py | 4 +- .../glusterd/test_volume_network_ping_timeout.py | 15 +++++--- .../functional/glusterd/test_volume_operations.py | 4 +- .../glusterd/test_volume_reduce_replica.py | 4 +- tests/functional/glusterd/test_volume_reset.py | 6 +-- .../test_volume_set_with_quorum_enabled.py | 4 +- tests/functional/glusterd/test_volume_status.py | 14 ++++--- tests/functional/glusterd/test_volume_status_fd.py | 14 ++++--- .../test_volume_status_with_absent_bricks.py | 2 +- .../functional/glusterd/test_volume_status_xml.py | 5 +-- 30 files changed, 125 insertions(+), 109 deletions(-) (limited to 'tests/functional') diff --git a/tests/functional/glusterd/test_quorum_remove_brick.py b/tests/functional/glusterd/test_quorum_remove_brick.py index e4caa065f..4e57c90f1 100644 --- a/tests/functional/glusterd/test_quorum_remove_brick.py +++ b/tests/functional/glusterd/test_quorum_remove_brick.py @@ -39,7 +39,7 @@ class TestServerQuorumNotMet(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() @@ -87,7 +87,7 @@ class TestServerQuorumNotMet(GlusterBaseClass): % self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_quorum_remove_brick(self): ''' diff --git a/tests/functional/glusterd/test_quorum_syslog.py b/tests/functional/glusterd/test_quorum_syslog.py index 4e66afd0f..a956e10af 100644 --- a/tests/functional/glusterd/test_quorum_syslog.py +++ b/tests/functional/glusterd/test_quorum_syslog.py @@ -35,7 +35,7 @@ class TestQuorumRelatedMessagesInSyslog(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() @@ -47,7 +47,8 @@ class TestQuorumRelatedMessagesInSyslog(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() + self.volume_list = [] # create a volume ret = setup_volume(self.mnode, self.all_servers_info, @@ -119,7 +120,7 @@ class TestQuorumRelatedMessagesInSyslog(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", volume) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_quorum_messages_in_syslog_with_more_volumes(self): """ diff --git a/tests/functional/glusterd/test_readonly_option_on_volume.py b/tests/functional/glusterd/test_readonly_option_on_volume.py index 064d1ac8a..d066189d4 100644 --- a/tests/functional/glusterd/test_readonly_option_on_volume.py +++ b/tests/functional/glusterd/test_readonly_option_on_volume.py @@ -18,7 +18,10 @@ Test read-only option on volumes """ +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.misc.misc_libs import upload_scripts @@ -32,7 +35,7 @@ class TestReadOnlyOptionOnVolume(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 " @@ -53,7 +56,7 @@ class TestReadOnlyOptionOnVolume(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) @@ -99,12 +102,13 @@ class TestReadOnlyOptionOnVolume(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 2 " "--max-num-of-dirs 2 " - "--num-of-files 5 %s" % (self.script_upload_path, + "--num-of-files 5 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) @@ -136,12 +140,13 @@ class TestReadOnlyOptionOnVolume(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 2 " "--max-num-of-dirs 2 " - "--num-of-files 5 %s" % (self.script_upload_path, + "--num-of-files 5 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) diff --git a/tests/functional/glusterd/test_rebalance_hang.py b/tests/functional/glusterd/test_rebalance_hang.py index a826703c1..9bbf6d8f4 100644 --- a/tests/functional/glusterd/test_rebalance_hang.py +++ b/tests/functional/glusterd/test_rebalance_hang.py @@ -46,7 +46,7 @@ class TestRebalanceHang(GlusterBaseClass): raise ExecutionError("Failed to detach servers %s" % self.servers) g.log.info("Peer detach SUCCESSFUL.") - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): @@ -76,7 +76,7 @@ class TestRebalanceHang(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_rebalance_hang(self): """ diff --git a/tests/functional/glusterd/test_rebalance_new_node.py b/tests/functional/glusterd/test_rebalance_new_node.py index a9cd0fea6..73fed5e8c 100644 --- a/tests/functional/glusterd/test_rebalance_new_node.py +++ b/tests/functional/glusterd/test_rebalance_new_node.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.gluster.volume_libs import (setup_volume, cleanup_volume) @@ -33,8 +36,7 @@ from glustolibs.gluster.mount_ops import is_mounted class TestRebalanceStatus(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() @@ -87,13 +89,7 @@ class TestRebalanceStatus(GlusterBaseClass): raise ExecutionError("Peer probe failed to all the servers from " "the node.") - GlusterBaseClass.tearDown.im_func(self) - - @classmethod - def tearDownClass(cls): - - # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + self.get_super_method(self, 'tearDown')() def test_rebalance_status_from_newly_probed_node(self): @@ -131,12 +127,13 @@ class TestRebalanceStatus(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 10 " "--dir-length 5 " "--max-num-of-dirs 3 " - "--num-of-files 100 %s" % (self.script_upload_path, + "--num-of-files 100 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) ret = g.run(mount_obj.client_system, cmd) diff --git a/tests/functional/glusterd/test_rebalance_spurious.py b/tests/functional/glusterd/test_rebalance_spurious.py index c9dbed035..7b8fc513b 100644 --- a/tests/functional/glusterd/test_rebalance_spurious.py +++ b/tests/functional/glusterd/test_rebalance_spurious.py @@ -46,7 +46,7 @@ class TestSpuriousRebalance(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): @@ -76,7 +76,7 @@ class TestSpuriousRebalance(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_spurious_rebalance(self): """ diff --git a/tests/functional/glusterd/test_rebalance_when_quorum_not_met.py b/tests/functional/glusterd/test_rebalance_when_quorum_not_met.py index bfd300927..a96e1d2b6 100644 --- a/tests/functional/glusterd/test_rebalance_when_quorum_not_met.py +++ b/tests/functional/glusterd/test_rebalance_when_quorum_not_met.py @@ -38,7 +38,7 @@ class TestServerQuorumNotMet(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() @@ -76,7 +76,7 @@ class TestServerQuorumNotMet(GlusterBaseClass): % self.volname) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_rebalance_quorum(self): ''' diff --git a/tests/functional/glusterd/test_remove_brick_after_restart_glusterd.py b/tests/functional/glusterd/test_remove_brick_after_restart_glusterd.py index 3b81dc6bd..a538ba073 100644 --- a/tests/functional/glusterd/test_remove_brick_after_restart_glusterd.py +++ b/tests/functional/glusterd/test_remove_brick_after_restart_glusterd.py @@ -44,7 +44,7 @@ class TestRemoveBrickAfterRestartGlusterd(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): @@ -75,7 +75,7 @@ class TestRemoveBrickAfterRestartGlusterd(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_remove_brick(self): """ diff --git a/tests/functional/glusterd/test_remove_brick_scenarios.py b/tests/functional/glusterd/test_remove_brick_scenarios.py index 0dc006812..ee1d7052a 100644 --- a/tests/functional/glusterd/test_remove_brick_scenarios.py +++ b/tests/functional/glusterd/test_remove_brick_scenarios.py @@ -33,7 +33,7 @@ class TestRemoveBrickScenarios(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes cls.volume['voltype'] = { @@ -44,7 +44,7 @@ class TestRemoveBrickScenarios(GlusterBaseClass): def setUp(self): # 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) @@ -62,7 +62,7 @@ class TestRemoveBrickScenarios(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_remove_brick_scenarios(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_remove_brick_when_quorum_not_met.py b/tests/functional/glusterd/test_remove_brick_when_quorum_not_met.py index 463b1c4e7..5b1dc7216 100644 --- a/tests/functional/glusterd/test_remove_brick_when_quorum_not_met.py +++ b/tests/functional/glusterd/test_remove_brick_when_quorum_not_met.py @@ -30,8 +30,7 @@ from glustolibs.gluster.brick_ops import remove_brick class TestRemoveBrickWhenQuorumNotMet(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() @@ -72,7 +71,7 @@ class TestRemoveBrickWhenQuorumNotMet(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_remove_brick_when_quorum_not_met(self): diff --git a/tests/functional/glusterd/test_replace_brick_quorum_not_met.py b/tests/functional/glusterd/test_replace_brick_quorum_not_met.py index 4081c7d90..a6dc531d5 100644 --- a/tests/functional/glusterd/test_replace_brick_quorum_not_met.py +++ b/tests/functional/glusterd/test_replace_brick_quorum_not_met.py @@ -86,7 +86,7 @@ class TestReplaceBrickWhenQuorumNotMet(GlusterBaseClass): "dir's of deleted volume") # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_replace_brick_quorum(self): diff --git a/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py b/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py index c1288f9fe..cfa0f3a3e 100644 --- a/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py +++ b/tests/functional/glusterd/test_restart_glusterd_while_rebalancing.py @@ -18,8 +18,11 @@ Test restart glusterd while rebalance is in progress """ +import sys from time import sleep + 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.volume_libs import form_bricks_list_to_add_brick @@ -40,7 +43,7 @@ class TestRestartGlusterdWhileRebalance(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 " @@ -83,7 +86,7 @@ class TestRestartGlusterdWhileRebalance(GlusterBaseClass): self.volname) # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() def tearDown(self): """ @@ -127,12 +130,13 @@ class TestRestartGlusterdWhileRebalance(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 4 " "--dir-length 6 " "--max-num-of-dirs 3 " - "--num-of-files 25 %s" % (self.script_upload_path, + "--num-of-files 25 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, cmd, diff --git a/tests/functional/glusterd/test_self_heal_quota_daemon_after_reboot.py b/tests/functional/glusterd/test_self_heal_quota_daemon_after_reboot.py index c65b92fa4..3f8248be4 100644 --- a/tests/functional/glusterd/test_self_heal_quota_daemon_after_reboot.py +++ b/tests/functional/glusterd/test_self_heal_quota_daemon_after_reboot.py @@ -32,7 +32,7 @@ from glustolibs.gluster.gluster_init import is_glusterd_running @runs_on([['replicated', 'distributed-replicated'], ['glusterfs']]) class TestSelfHealDeamonQuotaDeamonAfterReboot(GlusterBaseClass): def setUp(self): - GlusterBaseClass.setUpClass.im_func(self) + self.get_super_method(self, 'setUp')() # checking for peer status from every node ret = self.validate_peers_are_connected() @@ -69,12 +69,10 @@ class TestSelfHealDeamonQuotaDeamonAfterReboot(GlusterBaseClass): # Getting self-heal daemon and quota daemon pids of every host from # gluster volume status for server in self.servers: - shd_pid = \ - (vol_status[self.volname][server]['Self-heal Daemon']['pid']) - quota_pid = \ - (vol_status[self.volname][server]['Quota Daemon']['pid']) - vol_status_quotad_pid_list.append(quota_pid) - vol_status_shd_pid_list.append(shd_pid) + vol_status_quotad_pid_list.append( + vol_status[self.volname][server]['Quota Daemon']['pid']) + vol_status_shd_pid_list.append( + vol_status[self.volname][server]['Self-heal Daemon']['pid']) g.log.info("shd list from get volume status: %s", vol_status_shd_pid_list) @@ -87,13 +85,20 @@ class TestSelfHealDeamonQuotaDeamonAfterReboot(GlusterBaseClass): # Finding and Storing all hosts self heal daemon # in to sh_daemon_list, all # host quota daemon into quotad_list list using ps command - for host in self.servers: - ret, out, _ = g.run(host, "ps -eaf | grep glustershd | " - "grep -v grep | awk '{ print $2 }'") - sh_daemon_list.append(out.strip()) - ret, out, _ = g.run(host, "ps -eaf | grep quotad | grep -v grep |" - " awk '{ print $2 }'") - quotad_list.append(out.strip()) + for daemon_name, daemon_list in (('glustershd', sh_daemon_list), + ('quotad', quotad_list)): + for host in self.servers: + cmd = "ps -eaf |grep %s |grep -v grep | awk '{ print $2 }'" % ( + daemon_name) + ret, out, err = g.run(host, cmd) + err_msg = ( + "Failed to find '%s' daemon on the '%s' host using " + "'ps -eaf' command.\nret: %s\nout: %s\nerr: %s" % ( + daemon_name, host, ret, out, err) + ) + self.assertEqual(ret, 0, err_msg) + daemon_list.append(out.strip()) + g.log.info("shd list :%s", sh_daemon_list) g.log.info("quotad list :%s", quotad_list) @@ -102,14 +107,9 @@ class TestSelfHealDeamonQuotaDeamonAfterReboot(GlusterBaseClass): # Here comparing the list of daemons got from ps command and # list of daemons got from vol status command, # all daemons should match from both the list - ret = cmp(sorted(sh_daemon_list + quotad_list), - sorted(vol_status_shd_pid_list + vol_status_quotad_pid_list)) - if ret == 0: - ps_daemon_len = len(sh_daemon_list + quotad_list) - vol_status_daemon_len = len((vol_status_shd_pid_list + - vol_status_quotad_pid_list)) - return bool(ps_daemon_len == len(self.servers) * 2 | - vol_status_daemon_len == len(self.servers) * 2) + if sorted(sh_daemon_list + quotad_list) == sorted( + vol_status_shd_pid_list + vol_status_quotad_pid_list): + return len(sh_daemon_list + quotad_list) == len(self.servers) * 2 return False diff --git a/tests/functional/glusterd/test_setting_volume_option_when_one_node_is_down_in_cluster.py b/tests/functional/glusterd/test_setting_volume_option_when_one_node_is_down_in_cluster.py index 1fb3b5171..abcdf30cf 100644 --- a/tests/functional/glusterd/test_setting_volume_option_when_one_node_is_down_in_cluster.py +++ b/tests/functional/glusterd/test_setting_volume_option_when_one_node_is_down_in_cluster.py @@ -34,8 +34,7 @@ from glustolibs.gluster.peer_ops import (peer_probe_servers, class VolumeInfoSync(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() @@ -67,7 +66,7 @@ class VolumeInfoSync(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_sync_functinality(self): diff --git a/tests/functional/glusterd/test_setting_volume_option_with_more_than_4096_characters.py b/tests/functional/glusterd/test_setting_volume_option_with_more_than_4096_characters.py index d6c517923..9a7f764d5 100644 --- a/tests/functional/glusterd/test_setting_volume_option_with_more_than_4096_characters.py +++ b/tests/functional/glusterd/test_setting_volume_option_with_more_than_4096_characters.py @@ -28,8 +28,7 @@ from glustolibs.gluster.gluster_init import (restart_glusterd, 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() @@ -56,7 +55,7 @@ class TestVolumeOptionSetWithMaxcharacters(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_setting_vol_option_with_max_characters(self): diff --git a/tests/functional/glusterd/test_shared_storage.py b/tests/functional/glusterd/test_shared_storage.py index 3b8903196..c2fcd00bc 100644 --- a/tests/functional/glusterd/test_shared_storage.py +++ b/tests/functional/glusterd/test_shared_storage.py @@ -39,7 +39,7 @@ class SharedStorage(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() @@ -60,7 +60,7 @@ class SharedStorage(GlusterBaseClass): g.log.info("Volume deleted successfully : %s", volume) # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_shared_storage(self): """This test case includes: diff --git a/tests/functional/glusterd/test_status_string_in_volstatus.py b/tests/functional/glusterd/test_status_string_in_volstatus.py index 0382e7212..b43fb90e3 100644 --- a/tests/functional/glusterd/test_status_string_in_volstatus.py +++ b/tests/functional/glusterd/test_status_string_in_volstatus.py @@ -37,7 +37,7 @@ class TestTaskTypeAndStatus(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 TestTaskTypeAndStatus(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_status_string(self): ''' diff --git a/tests/functional/glusterd/test_volume_create.py b/tests/functional/glusterd/test_volume_create.py index 4046b8130..fe519acf0 100644 --- a/tests/functional/glusterd/test_volume_create.py +++ b/tests/functional/glusterd/test_volume_create.py @@ -41,7 +41,7 @@ class TestVolumeCreate(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() ret = cls.validate_peers_are_connected() if not ret: @@ -73,7 +73,7 @@ class TestVolumeCreate(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_volume_create(self): ''' diff --git a/tests/functional/glusterd/test_volume_create_with_glusterd_restarts.py b/tests/functional/glusterd/test_volume_create_with_glusterd_restarts.py index 7021cc938..8c3d77b9d 100644 --- a/tests/functional/glusterd/test_volume_create_with_glusterd_restarts.py +++ b/tests/functional/glusterd/test_volume_create_with_glusterd_restarts.py @@ -44,7 +44,7 @@ class TestVolumeCreateWithGlusterdRestarts(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_volume_create_with_glusterd_restarts(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_volume_delete.py b/tests/functional/glusterd/test_volume_delete.py index e207bb4b0..89435e956 100644 --- a/tests/functional/glusterd/test_volume_delete.py +++ b/tests/functional/glusterd/test_volume_delete.py @@ -35,7 +35,7 @@ class TestVolumeDelete(GlusterBaseClass): def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # check whether peers are in connected state ret = cls.validate_peers_are_connected() @@ -68,13 +68,13 @@ class TestVolumeDelete(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')() @classmethod def tearDownClass(cls): # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_vol_delete_when_one_of_nodes_is_down(self): diff --git a/tests/functional/glusterd/test_volume_get.py b/tests/functional/glusterd/test_volume_get.py index bd4dd86ec..a451268f7 100644 --- a/tests/functional/glusterd/test_volume_get.py +++ b/tests/functional/glusterd/test_volume_get.py @@ -34,7 +34,7 @@ class TestVolumeGet(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 TestVolumeGet(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_volume_get(self): """ diff --git a/tests/functional/glusterd/test_volume_network_ping_timeout.py b/tests/functional/glusterd/test_volume_network_ping_timeout.py index 7d72d8ab2..614aa198d 100644 --- a/tests/functional/glusterd/test_volume_network_ping_timeout.py +++ b/tests/functional/glusterd/test_volume_network_ping_timeout.py @@ -19,7 +19,10 @@ # of the volume. import re +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.misc.misc_libs import upload_scripts @@ -36,7 +39,7 @@ from glustolibs.io.utils import collect_mounts_arequal class CheckVolumeChecksumAfterChangingNetworkPingTimeOut(GlusterBaseClass): @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() g.log.info("Starting %s ", cls.__name__) # Uploading file_dir script in all client direcotries @@ -58,7 +61,7 @@ class CheckVolumeChecksumAfterChangingNetworkPingTimeOut(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") @@ -80,7 +83,7 @@ class CheckVolumeChecksumAfterChangingNetworkPingTimeOut(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_volume_checksum_after_changing_network_ping_timeout(self): @@ -112,8 +115,10 @@ class CheckVolumeChecksumAfterChangingNetworkPingTimeOut(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_files -f 10 --base-file-name newfile %s" - % (self.script_upload_path, mount_obj.mountpoint)) + cmd = ("/usr/bin/env python%d %s create_files -f 10 " + "--base-file-name newfile %s" % ( + sys.version_info.major, self.script_upload_path, + 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_volume_operations.py b/tests/functional/glusterd/test_volume_operations.py index 47807c6f9..23bcfe640 100644 --- a/tests/functional/glusterd/test_volume_operations.py +++ b/tests/functional/glusterd/test_volume_operations.py @@ -35,7 +35,7 @@ from glustolibs.gluster.exceptions import ExecutionError class TestVolumeCreate(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() if not ret: @@ -54,7 +54,7 @@ class TestVolumeCreate(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_volume_start_force(self): diff --git a/tests/functional/glusterd/test_volume_reduce_replica.py b/tests/functional/glusterd/test_volume_reduce_replica.py index 82a9a60cf..975651224 100644 --- a/tests/functional/glusterd/test_volume_reduce_replica.py +++ b/tests/functional/glusterd/test_volume_reduce_replica.py @@ -29,7 +29,7 @@ class TestVolumeReduceReplicaCount(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Override Volumes cls.volume['voltype'] = { @@ -60,7 +60,7 @@ class TestVolumeReduceReplicaCount(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_volume_reduce_replica_count(self): """ diff --git a/tests/functional/glusterd/test_volume_reset.py b/tests/functional/glusterd/test_volume_reset.py index ca97ce588..078722e56 100644 --- a/tests/functional/glusterd/test_volume_reset.py +++ b/tests/functional/glusterd/test_volume_reset.py @@ -35,7 +35,7 @@ class GlusterdVolumeReset(GlusterBaseClass): ''' @classmethod def setUpClass(cls): - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() g.log.info("Starting %s ", cls.__name__) # Creating Volume @@ -51,7 +51,7 @@ class GlusterdVolumeReset(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # command for volume reset g.log.info("started resetting volume") @@ -67,7 +67,7 @@ class GlusterdVolumeReset(GlusterBaseClass): tearDown for every test """ # Calling GlusterBaseClass tearDown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() @classmethod def tearDownClass(cls): diff --git a/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py b/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py index 24865d245..68078387a 100644 --- a/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py +++ b/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py @@ -29,7 +29,7 @@ class TestVolumeSetOpWithQuorum(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") @@ -77,7 +77,7 @@ class TestVolumeSetOpWithQuorum(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_volume_set_wit_quorum_enabled(self): # pylint: disable=too-many-statements diff --git a/tests/functional/glusterd/test_volume_status.py b/tests/functional/glusterd/test_volume_status.py index 109586f35..ef40ec219 100644 --- a/tests/functional/glusterd/test_volume_status.py +++ b/tests/functional/glusterd/test_volume_status.py @@ -19,8 +19,11 @@ Test Cases in this module related to Glusterd volume status while IOs in progress """ import random +import sys from time import sleep + 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.misc.misc_libs import upload_scripts @@ -34,7 +37,7 @@ class VolumeStatusWhenIOInProgress(GlusterBaseClass): @classmethod def setUpClass(cls): cls.counter = 1 - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # checking for peer status from every node ret = cls.validate_peers_are_connected() @@ -63,7 +66,7 @@ class VolumeStatusWhenIOInProgress(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") @@ -100,7 +103,7 @@ class VolumeStatusWhenIOInProgress(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_volume_status_inode_while_io_in_progress(self): ''' @@ -129,12 +132,13 @@ class VolumeStatusWhenIOInProgress(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 15 " "--max-num-of-dirs 5 " - "--num-of-files 25 %s" % (self.script_upload_path, + "--num-of-files 25 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) diff --git a/tests/functional/glusterd/test_volume_status_fd.py b/tests/functional/glusterd/test_volume_status_fd.py index 415c96de7..a54545dcd 100644 --- a/tests/functional/glusterd/test_volume_status_fd.py +++ b/tests/functional/glusterd/test_volume_status_fd.py @@ -20,7 +20,10 @@ """ import random +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.misc.misc_libs import upload_scripts @@ -34,7 +37,7 @@ class VolumeStatusFdWhenIOInProgress(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 " @@ -55,7 +58,7 @@ class VolumeStatusFdWhenIOInProgress(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) @@ -85,7 +88,7 @@ class VolumeStatusFdWhenIOInProgress(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_volume_status_fd(self): @@ -112,12 +115,13 @@ class VolumeStatusFdWhenIOInProgress(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 10 " "--max-num-of-dirs 5 " - "--num-of-files 15 %s" % (self.script_upload_path, + "--num-of-files 15 %s" % (sys.version_info.major, + self.script_upload_path, self.counter, mount_obj.mountpoint)) diff --git a/tests/functional/glusterd/test_volume_status_with_absent_bricks.py b/tests/functional/glusterd/test_volume_status_with_absent_bricks.py index 9a35c2fef..5a3d60485 100644 --- a/tests/functional/glusterd/test_volume_status_with_absent_bricks.py +++ b/tests/functional/glusterd/test_volume_status_with_absent_bricks.py @@ -41,7 +41,7 @@ class TestVolumeStatusWithAbsentBricks(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_volume_absent_bricks(self): ''' diff --git a/tests/functional/glusterd/test_volume_status_xml.py b/tests/functional/glusterd/test_volume_status_xml.py index 1f5475374..69f1488ba 100644 --- a/tests/functional/glusterd/test_volume_status_xml.py +++ b/tests/functional/glusterd/test_volume_status_xml.py @@ -29,8 +29,7 @@ from glustolibs.gluster.peer_ops import (peer_probe_servers, peer_detach, class TestVolumeStatusxml(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 +59,7 @@ class TestVolumeStatusxml(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_volume_status_xml(self): -- cgit