From 099438eec88274839411f51cd214f6ff7fdac87c Mon Sep 17 00:00:00 2001 From: Valerii Ponomarov Date: Thu, 12 Dec 2019 22:10:49 +0530 Subject: [py2to3] Add py3 support in 'tests/functional/arbiter' Change-Id: I5a60646b984557ed024cb4b3a8088ce7dfb7622c Signed-off-by: Valerii Ponomarov --- .../test_create_snapshot_and_verify_content.py | 24 +++++++------ .../test_data_self_heal_algorithm_diff_default.py | 24 ++++++++----- ...t_data_self_heal_algorithm_diff_heal_command.py | 24 ++++++++----- .../test_data_self_heal_algorithm_full_default.py | 24 ++++++++----- .../arbiter/test_entry_self_heal_heal_command.py | 41 +++++++++++++--------- ...dling_data_split_brain_of_files_heal_command.py | 15 ++++---- .../functional/arbiter/test_metadata_self_heal.py | 10 +++--- .../test_mount_point_while_deleting_files.py | 26 ++++++++------ ...t_no_data_loss_arbiter_vol_after_rename_file.py | 30 ++++++++-------- ...st_oom_on_client_heal_is_in_progress_arbiter.py | 15 ++++---- ...test_remove_faulty_subvol_and_add_new_subvol.py | 16 +++++---- ...t_replacing_all_arbiter_bricks_in_the_volume.py | 16 +++++---- ...ng_meta_data_split_brain_extended_attributes.py | 4 +-- .../test_self_heal_algorithm_full_daemon_off.py | 6 ++-- .../test_self_heal_differing_in_file_type.py | 10 +++--- .../arbiter/test_self_heal_symbolic_links.py | 10 +++--- 16 files changed, 171 insertions(+), 124 deletions(-) diff --git a/tests/functional/arbiter/test_create_snapshot_and_verify_content.py b/tests/functional/arbiter/test_create_snapshot_and_verify_content.py index 53b433ef6..ce479e6b7 100755 --- a/tests/functional/arbiter/test_create_snapshot_and_verify_content.py +++ b/tests/functional/arbiter/test_create_snapshot_and_verify_content.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.snap_ops import (snap_create, snap_restore) @@ -36,7 +39,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -54,7 +57,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volumes if self.volume_type == "distributed-replicated": @@ -100,7 +103,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): g.log.info('Clearing for all brick is successful') # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_create_snapshot_and_verify_content(self): """ @@ -118,13 +121,14 @@ class TestArbiterSelfHeal(GlusterBaseClass): self.mounts[0].client_system, self.mounts[0].mountpoint) # Create dirs with file g.log.info('Creating dirs with file...') - command = ("python %s create_deep_dirs_with_files " + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "-d 2 " "-l 2 " "-n 2 " "-f 20 " - "%s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + "%s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) ret, _, err = g.run(self.mounts[0].client_system, command, user=self.mounts[0].user) @@ -150,14 +154,14 @@ class TestArbiterSelfHeal(GlusterBaseClass): self.mounts[0].client_system, self.mounts[0].mountpoint) # Create dirs with file g.log.info('Adding dirs with file...') - command = ("python %s create_deep_dirs_with_files " + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "-d 2 " "-l 2 " "-n 2 " "-f 20 " - "%s" - % (self.script_upload_path, - self.mounts[0].mountpoint+'/new_files')) + "%s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint+'/new_files')) ret, _, err = g.run(self.mounts[0].client_system, command, user=self.mounts[0].user) diff --git a/tests/functional/arbiter/test_data_self_heal_algorithm_diff_default.py b/tests/functional/arbiter/test_data_self_heal_algorithm_diff_default.py index fd6aaa98e..2a5f4d4d8 100644 --- a/tests/functional/arbiter/test_data_self_heal_algorithm_diff_default.py +++ b/tests/functional/arbiter/test_data_self_heal_algorithm_diff_default.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_ops import set_volume_options @@ -46,7 +49,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -74,7 +77,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -96,7 +99,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_data_self_heal_algorithm_diff_default(self): """ @@ -127,8 +130,9 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Generating data for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) # Creating files - command = ("python %s create_files -f 100 %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + command = "/usr/bin/env python%d %s create_files -f 100 %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, command, user=self.mounts[0].user) @@ -143,10 +147,10 @@ class TestSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) @@ -165,8 +169,10 @@ class TestSelfHeal(GlusterBaseClass): all_mounts_procs = [] g.log.info("Modifying data for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) - command = ("python %s create_files -f 100 --fixed-file-size 1M %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + command = ("/usr/bin/env python%d %s create_files -f 100 " + "--fixed-file-size 1M %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, command, user=self.mounts[0].user) diff --git a/tests/functional/arbiter/test_data_self_heal_algorithm_diff_heal_command.py b/tests/functional/arbiter/test_data_self_heal_algorithm_diff_heal_command.py index fadfc1150..2fd32a14d 100755 --- a/tests/functional/arbiter/test_data_self_heal_algorithm_diff_heal_command.py +++ b/tests/functional/arbiter/test_data_self_heal_algorithm_diff_heal_command.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_ops import set_volume_options @@ -47,7 +50,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -75,7 +78,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -97,7 +100,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_data_self_heal_algorithm_diff_heal_command(self): """ @@ -148,8 +151,9 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Generating data for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) # Creating files - command = ("python %s create_files -f 100 %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + command = "/usr/bin/env python%d %s create_files -f 100 %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, command, user=self.mounts[0].user) @@ -171,10 +175,10 @@ class TestSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) @@ -193,8 +197,10 @@ class TestSelfHeal(GlusterBaseClass): all_mounts_procs = [] g.log.info("Modifying data for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) - command = ("python %s create_files -f 100 --fixed-file-size 1M %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + command = ("/usr/bin/env python%d %s create_files -f 100 " + "--fixed-file-size 1M %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, command, user=self.mounts[0].user) diff --git a/tests/functional/arbiter/test_data_self_heal_algorithm_full_default.py b/tests/functional/arbiter/test_data_self_heal_algorithm_full_default.py index 710673a51..c60ce3123 100755 --- a/tests/functional/arbiter/test_data_self_heal_algorithm_full_default.py +++ b/tests/functional/arbiter/test_data_self_heal_algorithm_full_default.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_ops import set_volume_options @@ -45,7 +48,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -73,7 +76,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -95,7 +98,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_data_self_heal_algorithm_full_default(self): """ @@ -126,8 +129,9 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Generating data for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) # Creating files - command = ("python %s create_files -f 100 %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + command = "/usr/bin/env python%d %s create_files -f 100 %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint) proc = g.run_async(self.mounts[0].client_system, command, user=self.mounts[0].user) @@ -142,10 +146,10 @@ class TestSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) @@ -164,8 +168,10 @@ class TestSelfHeal(GlusterBaseClass): all_mounts_procs = [] g.log.info("Modifying data for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) - command = ("python %s create_files -f 100 --fixed-file-size 1M %s" - % (self.script_upload_path, self.mounts[0].mountpoint)) + command = ("/usr/bin/env python%d %s create_files -f 100 " + "--fixed-file-size 1M %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) proc = g.run_async(self.mounts[0].client_system, command, user=self.mounts[0].user) diff --git a/tests/functional/arbiter/test_entry_self_heal_heal_command.py b/tests/functional/arbiter/test_entry_self_heal_heal_command.py index d1b8cb3e8..a3e55dc2e 100644 --- a/tests/functional/arbiter/test_entry_self_heal_heal_command.py +++ b/tests/functional/arbiter/test_entry_self_heal_heal_command.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_ops import set_volume_options @@ -48,7 +51,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -76,7 +79,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -97,7 +100,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_entry_self_heal_heal_command(self): """ @@ -145,12 +148,13 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Starting IO on all mounts...") g.log.info("Starting IO on %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) - cmd = ("python %s create_deep_dirs_with_files " + cmd = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "--dir-length 2 " "--dir-depth 2 " "--max-num-of-dirs 2 " - "--num-of-files 20 %s/files" % (self.script_upload_path, - self.mounts[0].mountpoint)) + "--num-of-files 20 %s/files" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint)) ret, _, err = g.run(self.mounts[0].client_system, cmd, user=self.mounts[0].user) self.assertFalse(ret, 'Failed to create the data for %s: %s' @@ -160,13 +164,14 @@ class TestSelfHeal(GlusterBaseClass): # Command list to do different operations with data - # create, rename, copy and delete - cmd_list = ["python %s create_files -f 20 %s/files", - "python %s mv %s/files", - # 'copy' command works incorrect. disable until fixed - # "python %s copy --dest-dir %s/new_dir %s/files", - "python %s delete %s"] - - for cmd in cmd_list: + cmds = ( + "/usr/bin/env python%d %s create_files -f 20 %s/files", + "/usr/bin/env python%d %s mv %s/files", + # 'copy' command works incorrect. disable until fixed + # "/usr/bin/env python%d %s copy --dest-dir %s/new_dir %s/files", + "/usr/bin/env python%d %s delete %s", + ) + for cmd in cmds: # Get arequal before getting bricks offline g.log.info('Getting arequal before getting bricks offline...') ret, arequals = collect_mounts_arequal(self.mounts) @@ -186,10 +191,10 @@ class TestSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', @@ -225,11 +230,13 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Modifying IO on %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) if 'copy --dest-dir' in cmd: - parsed_cmd = cmd % (self.script_upload_path, + parsed_cmd = cmd % (sys.version_info.major, + self.script_upload_path, self.mounts[0].mountpoint, self.mounts[0].mountpoint) else: - parsed_cmd = cmd % (self.script_upload_path, + parsed_cmd = cmd % (sys.version_info.major, + self.script_upload_path, self.mounts[0].mountpoint) ret, _, err = g.run(self.mounts[0].client_system, parsed_cmd, user=self.mounts[0].user) diff --git a/tests/functional/arbiter/test_handling_data_split_brain_of_files_heal_command.py b/tests/functional/arbiter/test_handling_data_split_brain_of_files_heal_command.py index 37820ba1a..7e61485f0 100755 --- a/tests/functional/arbiter/test_handling_data_split_brain_of_files_heal_command.py +++ b/tests/functional/arbiter/test_handling_data_split_brain_of_files_heal_command.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_ops import set_volume_options @@ -43,7 +46,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -61,7 +64,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -103,7 +106,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_handling_data_split_brain(self): """ @@ -314,9 +317,9 @@ class TestArbiterSelfHeal(GlusterBaseClass): for mount_obj in self.mounts: g.log.info("Start heal for %s:%s", mount_obj.client_system, mount_obj.mountpoint) - command = ("python %s read %s" - % (self.script_upload_path, - self.mounts[0].mountpoint)) + command = "/usr/bin/env python%d %s read %s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint) ret, _, err = g.run(mount_obj.client_system, command) self.assertFalse(ret, err) g.log.info("Heal triggered for %s:%s", diff --git a/tests/functional/arbiter/test_metadata_self_heal.py b/tests/functional/arbiter/test_metadata_self_heal.py index 3d0a37447..4c5b8eff7 100755 --- a/tests/functional/arbiter/test_metadata_self_heal.py +++ b/tests/functional/arbiter/test_metadata_self_heal.py @@ -75,7 +75,7 @@ class TestMetadataSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -103,7 +103,7 @@ class TestMetadataSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Create user qa for mount_object in self.mounts: @@ -139,7 +139,7 @@ class TestMetadataSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_metadata_self_heal(self): """ @@ -218,10 +218,10 @@ class TestMetadataSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) diff --git a/tests/functional/arbiter/test_mount_point_while_deleting_files.py b/tests/functional/arbiter/test_mount_point_while_deleting_files.py index 1bbdf279f..e83db03ef 100755 --- a/tests/functional/arbiter/test_mount_point_while_deleting_files.py +++ b/tests/functional/arbiter/test_mount_point_while_deleting_files.py @@ -14,9 +14,11 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - import os +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.volume_libs import setup_volume, cleanup_volume @@ -38,7 +40,7 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -125,7 +127,7 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -178,7 +180,7 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): cls.volname, cls.client) # calling GlusterBaseClass tearDownClass - GlusterBaseClass.tearDownClass.im_func(cls) + cls.get_super_method(cls, 'tearDownClass')() def test_mount_point_not_go_to_rofs(self): """ @@ -197,11 +199,12 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_files " + command = ("/usr/bin/env python%d %s create_files " "-f 100 " "--fixed-file-size 1M " - "%s" - % (self.script_upload_path, mount_obj.mountpoint)) + "%s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) @@ -218,10 +221,10 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): for volname in volume_list: bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # bring bricks offline g.log.info("Going to bring down the brick process for %s", @@ -240,8 +243,9 @@ class VolumeSetDataSelfHealTests(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Delete files g.log.info('Deleting files...') - command = ("python %s delete %s" - % (self.script_upload_path, mount_obj.mountpoint)) + command = "/usr/bin/env python%d %s delete %s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) all_mounts_procs.append(proc) diff --git a/tests/functional/arbiter/test_no_data_loss_arbiter_vol_after_rename_file.py b/tests/functional/arbiter/test_no_data_loss_arbiter_vol_after_rename_file.py index 8b2b0ff1e..fe52b0d3f 100755 --- a/tests/functional/arbiter/test_no_data_loss_arbiter_vol_after_rename_file.py +++ b/tests/functional/arbiter/test_no_data_loss_arbiter_vol_after_rename_file.py @@ -14,8 +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_ops import (set_volume_options, @@ -39,7 +41,7 @@ class ArbiterSelfHealTests(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -61,7 +63,7 @@ class ArbiterSelfHealTests(GlusterBaseClass): """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume %s", self.volname) @@ -86,7 +88,7 @@ class ArbiterSelfHealTests(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_no_data_loss_arbiter_vol_after_rename_file(self): """ @@ -131,10 +133,10 @@ class ArbiterSelfHealTests(GlusterBaseClass): self.mounts[0].client_system, self.mounts[0].mountpoint) # Create dir g.log.info('Creating dir...') - command = ('python %s create_deep_dir -d 1 -l 0 -n 1 %s/%s' - % (self.script_upload_path, - self.mounts[0].mountpoint, - test_dir)) + command = ('/usr/bin/env python%d %s create_deep_dir -d 1 -l 0 -n 1 ' + '%s/%s' % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint, test_dir)) ret, _, err = g.run(self.mounts[0].client_system, command, user=self.mounts[0].user) @@ -166,10 +168,9 @@ class ArbiterSelfHealTests(GlusterBaseClass): self.mounts[0].client_system, self.mounts[0].mountpoint) # Create file g.log.info('Creating file...') - command = ("python %s create_files -f 1 %s/%s" - % (self.script_upload_path, - self.mounts[0].mountpoint, - test_dir)) + command = "/usr/bin/env python%d %s create_files -f 1 %s/%s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint, test_dir) ret, _, err = g.run(self.mounts[0].client_system, command, user=self.mounts[0].user) @@ -215,10 +216,9 @@ class ArbiterSelfHealTests(GlusterBaseClass): # Rename file under test_dir g.log.info("Renaming file for %s:%s", self.mounts[0].client_system, self.mounts[0].mountpoint) - command = ("python %s mv %s/%s" - % (self.script_upload_path, - self.mounts[0].mountpoint, - test_dir)) + command = "/usr/bin/env python%d %s mv %s/%s" % ( + sys.version_info.major, self.script_upload_path, + self.mounts[0].mountpoint, test_dir) ret, _, err = g.run(self.mounts[0].client_system, command) self.assertEqual(ret, 0, err) g.log.info("Renaming file for %s:%s is successful", diff --git a/tests/functional/arbiter/test_oom_on_client_heal_is_in_progress_arbiter.py b/tests/functional/arbiter/test_oom_on_client_heal_is_in_progress_arbiter.py index 0e55cdf8a..5d684b4d5 100755 --- a/tests/functional/arbiter/test_oom_on_client_heal_is_in_progress_arbiter.py +++ b/tests/functional/arbiter/test_oom_on_client_heal_is_in_progress_arbiter.py @@ -14,8 +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.brick_libs import (bring_bricks_offline, @@ -38,7 +40,7 @@ class ArbiterSelfHealTests(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -59,7 +61,7 @@ class ArbiterSelfHealTests(GlusterBaseClass): setUp method for every test """ # calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] self.io_validation_complete = False @@ -101,7 +103,7 @@ class ArbiterSelfHealTests(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_oom_on_client_heal_in_progress(self): """ @@ -120,11 +122,12 @@ class ArbiterSelfHealTests(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create files g.log.info('Creating files...') - command = ("python %s create_files " + command = ("/usr/bin/env python%d %s create_files " "-f 1000 " "--fixed-file-size 10k " - "%s" - % (self.script_upload_path, mount_obj.mountpoint)) + "%s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) diff --git a/tests/functional/arbiter/test_remove_faulty_subvol_and_add_new_subvol.py b/tests/functional/arbiter/test_remove_faulty_subvol_and_add_new_subvol.py index 6768d7660..31d019d27 100644 --- a/tests/functional/arbiter/test_remove_faulty_subvol_and_add_new_subvol.py +++ b/tests/functional/arbiter/test_remove_faulty_subvol_and_add_new_subvol.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 (expand_volume, shrink_volume, @@ -41,7 +44,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -59,7 +62,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volumes if self.volume_type == "distributed-replicated": @@ -113,7 +116,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_remove_faulty_subvol_and_add_new_subvol(self): """ @@ -132,13 +135,14 @@ class TestArbiterSelfHeal(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create dirs with file g.log.info('Creating dirs with file...') - command = ("python %s create_deep_dirs_with_files " + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "-d 2 " "-l 2 " "-n 2 " "-f 20 " - "%s" - % (self.script_upload_path, mount_obj.mountpoint)) + "%s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) diff --git a/tests/functional/arbiter/test_replacing_all_arbiter_bricks_in_the_volume.py b/tests/functional/arbiter/test_replacing_all_arbiter_bricks_in_the_volume.py index c1a1b5d7c..e4f802d95 100755 --- a/tests/functional/arbiter/test_replacing_all_arbiter_bricks_in_the_volume.py +++ b/tests/functional/arbiter/test_replacing_all_arbiter_bricks_in_the_volume.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 ( @@ -44,7 +47,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Upload io scripts for running IO on mounts g.log.info("Upload io scripts to clients %s for running IO on mounts", @@ -62,7 +65,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volumes if self.volume_type == "distributed-replicated": @@ -127,7 +130,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_replacing_all_arbiters(self): """ @@ -159,13 +162,14 @@ class TestArbiterSelfHeal(GlusterBaseClass): mount_obj.client_system, mount_obj.mountpoint) # Create dirs with file g.log.info('Creating dirs with file...') - command = ("python %s create_deep_dirs_with_files " + command = ("/usr/bin/env python%d %s create_deep_dirs_with_files " "-d 3 " "-l 3 " "-n 3 " "-f 20 " - "%s" - % (self.script_upload_path, mount_obj.mountpoint)) + "%s" % ( + sys.version_info.major, self.script_upload_path, + mount_obj.mountpoint)) proc = g.run_async(mount_obj.client_system, command, user=mount_obj.user) diff --git a/tests/functional/arbiter/test_resolving_meta_data_split_brain_extended_attributes.py b/tests/functional/arbiter/test_resolving_meta_data_split_brain_extended_attributes.py index 0e9f945c2..02444c80a 100644 --- a/tests/functional/arbiter/test_resolving_meta_data_split_brain_extended_attributes.py +++ b/tests/functional/arbiter/test_resolving_meta_data_split_brain_extended_attributes.py @@ -41,7 +41,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volumes if self.volume_type == "distributed-replicated": @@ -93,7 +93,7 @@ class TestArbiterSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_resolving_meta_data(self): """ diff --git a/tests/functional/arbiter/test_self_heal_algorithm_full_daemon_off.py b/tests/functional/arbiter/test_self_heal_algorithm_full_daemon_off.py index 577961f36..4a1825fae 100644 --- a/tests/functional/arbiter/test_self_heal_algorithm_full_daemon_off.py +++ b/tests/functional/arbiter/test_self_heal_algorithm_full_daemon_off.py @@ -44,7 +44,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -72,7 +72,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -97,7 +97,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_self_heal_algorithm_full_daemon_off(self): """"" diff --git a/tests/functional/arbiter/test_self_heal_differing_in_file_type.py b/tests/functional/arbiter/test_self_heal_differing_in_file_type.py index 7a7480002..0a351b964 100755 --- a/tests/functional/arbiter/test_self_heal_differing_in_file_type.py +++ b/tests/functional/arbiter/test_self_heal_differing_in_file_type.py @@ -44,7 +44,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -72,7 +72,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() self.all_mounts_procs = [] @@ -96,7 +96,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_self_heal_differing_in_file_type(self): """ @@ -163,10 +163,10 @@ class TestSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) diff --git a/tests/functional/arbiter/test_self_heal_symbolic_links.py b/tests/functional/arbiter/test_self_heal_symbolic_links.py index 46b1889d3..22fa71ce8 100644 --- a/tests/functional/arbiter/test_self_heal_symbolic_links.py +++ b/tests/functional/arbiter/test_self_heal_symbolic_links.py @@ -46,7 +46,7 @@ class TestSelfHeal(GlusterBaseClass): @classmethod def setUpClass(cls): # Calling GlusterBaseClass setUpClass - GlusterBaseClass.setUpClass.im_func(cls) + cls.get_super_method(cls, 'setUpClass')() # Overriding the volume type to specifically test the volume type # Change from distributed-replicated to arbiter @@ -74,7 +74,7 @@ class TestSelfHeal(GlusterBaseClass): def setUp(self): # Calling GlusterBaseClass setUp - GlusterBaseClass.setUp.im_func(self) + self.get_super_method(self, 'setUp')() # Setup Volume and Mount Volume g.log.info("Starting to Setup Volume and Mount Volume") @@ -96,7 +96,7 @@ class TestSelfHeal(GlusterBaseClass): g.log.info("Successful in umounting the volume and Cleanup") # Calling GlusterBaseClass teardown - GlusterBaseClass.tearDown.im_func(self) + self.get_super_method(self, 'tearDown')() def test_self_heal_symbolic_links(self): """ @@ -181,10 +181,10 @@ class TestSelfHeal(GlusterBaseClass): # Select bricks to bring offline bricks_to_bring_offline_dict = (select_bricks_to_bring_offline( self.mnode, self.volname)) - bricks_to_bring_offline = filter(None, ( + bricks_to_bring_offline = list(filter(None, ( bricks_to_bring_offline_dict['hot_tier_bricks'] + bricks_to_bring_offline_dict['cold_tier_bricks'] + - bricks_to_bring_offline_dict['volume_bricks'])) + bricks_to_bring_offline_dict['volume_bricks']))) # Bring brick offline g.log.info('Bringing bricks %s offline...', bricks_to_bring_offline) -- cgit