diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2019-12-12 22:10:49 +0530 |
---|---|---|
committer | Bala Konda Reddy M <bmekala@redhat.com> | 2019-12-17 08:28:18 +0000 |
commit | 099438eec88274839411f51cd214f6ff7fdac87c (patch) | |
tree | eb9b0bb0967582e658a25f6f7d751ecacb3a0f9a /tests/functional/arbiter/test_entry_self_heal_heal_command.py | |
parent | e167fe2bd8d556ea79dc1cca424c0910f123ffdf (diff) |
[py2to3] Add py3 support in 'tests/functional/arbiter'
Change-Id: I5a60646b984557ed024cb4b3a8088ce7dfb7622c
Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
Diffstat (limited to 'tests/functional/arbiter/test_entry_self_heal_heal_command.py')
-rw-r--r-- | tests/functional/arbiter/test_entry_self_heal_heal_command.py | 41 |
1 files changed, 24 insertions, 17 deletions
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) |