summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-12-17 17:56:19 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2020-01-02 07:19:55 +0000
commit62aeeec189f145d521ebf719956a3fbc570af1ee (patch)
tree3545d970881d415e1934dd7f3ce09700ed54f66c /tests
parentb1fc01b6006a72e9a9828d64159ce19562a0956b (diff)
[py2to3] Fix bunch of py3 incompatibilities
Change-Id: I2e85670e50e3dab8727295c34aa6ec4f1326c19d Signed-off-by: Valerii Ponomarov <kiparis.kh@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/bvt/test_cvt.py17
-rw-r--r--tests/functional/bvt/test_vvt.py12
-rw-r--r--tests/functional/disperse/test_ec_fops_brickdown.py26
-rw-r--r--tests/functional/disperse/test_ec_reset.py25
-rw-r--r--tests/functional/disperse/test_ec_verify_datacorruption_during_full_heal.py16
-rwxr-xr-xtests/functional/multiplex/test_enabling_brick_mux.py2
-rw-r--r--tests/functional/snapshot/test_validate_snapshot_max_limit.py10
7 files changed, 66 insertions, 42 deletions
diff --git a/tests/functional/bvt/test_cvt.py b/tests/functional/bvt/test_cvt.py
index d774400..fdaf3dc 100644
--- a/tests/functional/bvt/test_cvt.py
+++ b/tests/functional/bvt/test_cvt.py
@@ -31,9 +31,12 @@
TODO:
- attach-tier, detach-tier
"""
+import sys
import time
-import pytest
+
from glusto.core import Glusto as g
+import pytest
+
from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on)
from glustolibs.gluster.volume_libs import enable_and_validate_volume_options
from glustolibs.gluster.volume_libs import (
@@ -123,14 +126,14 @@ class GlusterBasicFeaturesSanityBaseClass(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 5 %s" % (self.script_upload_path,
- self.counter,
- mount_obj.mountpoint))
+ "--num-of-files 5 %s" % (
+ sys.version_info.major, self.script_upload_path,
+ self.counter, mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, cmd,
user=mount_obj.user)
self.all_mounts_procs.append(proc)
@@ -711,10 +714,10 @@ class TestGlusterHealSanity(GlusterBasicFeaturesSanityBaseClass):
# 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 bricks offline
g.log.info("Bringing bricks: %s offline", bricks_to_bring_offline)
diff --git a/tests/functional/bvt/test_vvt.py b/tests/functional/bvt/test_vvt.py
index 9534f05..9d427bb 100644
--- a/tests/functional/bvt/test_vvt.py
+++ b/tests/functional/bvt/test_vvt.py
@@ -20,8 +20,11 @@
"""
-import pytest
+import sys
+
from glusto.core import Glusto as g
+import pytest
+
from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on)
from glustolibs.gluster.exceptions import ExecutionError
from glustolibs.gluster.gluster_init import is_glusterd_running
@@ -169,13 +172,14 @@ class VolumeAccessibilityTests(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 5 %s" % (self.script_upload_path, count,
- mount_obj.mountpoint))
+ "--num-of-files 5 %s" % (
+ sys.version_info.major, self.script_upload_path, count,
+ mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, cmd,
user=mount_obj.user)
all_mounts_procs.append(proc)
diff --git a/tests/functional/disperse/test_ec_fops_brickdown.py b/tests/functional/disperse/test_ec_fops_brickdown.py
index 1115232..f7cac1f 100644
--- a/tests/functional/disperse/test_ec_fops_brickdown.py
+++ b/tests/functional/disperse/test_ec_fops_brickdown.py
@@ -19,7 +19,11 @@ Test Description:
Tests File Operations on an EC volume when redundant bricks are
brought down
"""
+
+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
@@ -40,7 +44,7 @@ class TestFopsBrickdown(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",
@@ -56,7 +60,7 @@ class TestFopsBrickdown(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")
@@ -81,7 +85,7 @@ class TestFopsBrickdown(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_fops_ec_brickdown(self):
# pylint: disable=too-many-branches,too-many-statements,too-many-locals
@@ -261,14 +265,14 @@ class TestFopsBrickdown(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 5 %s/dir1" % (self.script_upload_path,
- count,
- mount_obj.mountpoint))
+ "--num-of-files 5 %s/dir1" % (
+ sys.version_info.major, self.script_upload_path, count,
+ mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, cmd,
user=mount_obj.user)
all_mounts_procs.append(proc)
@@ -300,14 +304,14 @@ class TestFopsBrickdown(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 5 %s/dir2" % (self.script_upload_path,
- count,
- mount_obj.mountpoint))
+ "--num-of-files 5 %s/dir2" % (
+ sys.version_info.major, self.script_upload_path, count,
+ mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, cmd,
user=mount_obj.user)
all_mounts_procs.append(proc)
diff --git a/tests/functional/disperse/test_ec_reset.py b/tests/functional/disperse/test_ec_reset.py
index 3f05e3f..6b115cc 100644
--- a/tests/functional/disperse/test_ec_reset.py
+++ b/tests/functional/disperse/test_ec_reset.py
@@ -21,9 +21,12 @@ Test Description:
or commit to reset a brick with source and destination defined
"""
from os import getcwd
-from time import sleep
from random import choice
+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.heal_libs import (monitor_heal_completion)
@@ -46,7 +49,7 @@ class TestBrickReset(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 TestBrickReset(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
@@ -90,7 +93,7 @@ class TestBrickReset(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_brickreset_ec_volume(self):
# pylint: disable=too-many-branches,too-many-statements,too-many-locals
@@ -165,9 +168,10 @@ class TestBrickReset(GlusterBaseClass):
# Create dirs with file
g.log.info('Creating dirs with file...')
- command = ("python %s create_deep_dirs_with_files "
- "-d 2 -l 2 -n 2 -f 20 %s/dir2"
- % (self.script_upload_path, mount_obj.mountpoint))
+ command = ("/usr/bin/env python%d %s create_deep_dirs_with_files "
+ "-d 2 -l 2 -n 2 -f 20 %s/dir2" % (
+ sys.version_info.major, self.script_upload_path,
+ mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, command,
user=mount_obj.user)
@@ -337,9 +341,10 @@ class TestBrickReset(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 "
- "-d 2 -l 2 -n 2 -f 20 %s/dir1"
- % (self.script_upload_path, mount_obj.mountpoint))
+ command = ("/usr/bin/env python%d %s create_deep_dirs_with_files "
+ "-d 2 -l 2 -n 2 -f 20 %s/dir1" % (
+ 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/disperse/test_ec_verify_datacorruption_during_full_heal.py b/tests/functional/disperse/test_ec_verify_datacorruption_during_full_heal.py
index 4847d9a..42f7421 100644
--- a/tests/functional/disperse/test_ec_verify_datacorruption_during_full_heal.py
+++ b/tests/functional/disperse/test_ec_verify_datacorruption_during_full_heal.py
@@ -14,8 +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 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.volume_libs import get_subvols
@@ -39,7 +42,7 @@ class TestHealFullNodeReboot(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",
@@ -55,7 +58,7 @@ class TestHealFullNodeReboot(GlusterBaseClass):
def setUp(self):
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
# Setup Volumes
self.all_mounts_procs = []
@@ -99,7 +102,7 @@ class TestHealFullNodeReboot(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_heal_full_node_reboot(self):
"""
@@ -120,13 +123,14 @@ class TestHealFullNodeReboot(GlusterBaseClass):
# 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/multiplex/test_enabling_brick_mux.py b/tests/functional/multiplex/test_enabling_brick_mux.py
index d2fb93b..d83c4eb 100755
--- a/tests/functional/multiplex/test_enabling_brick_mux.py
+++ b/tests/functional/multiplex/test_enabling_brick_mux.py
@@ -39,7 +39,7 @@ class TestBrickMultiplexing(GlusterBaseClass):
g.log.info("Disabled brick multiplexing successfully")
# Calling GlusterBaseClass teardown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
def test_enabling_brick_mux(self):
"""
diff --git a/tests/functional/snapshot/test_validate_snapshot_max_limit.py b/tests/functional/snapshot/test_validate_snapshot_max_limit.py
index 4b16aa4..61aff07 100644
--- a/tests/functional/snapshot/test_validate_snapshot_max_limit.py
+++ b/tests/functional/snapshot/test_validate_snapshot_max_limit.py
@@ -43,7 +43,10 @@ Steps :
"""
+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
@@ -135,13 +138,14 @@ class SnapCreateMax(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 5 %s" % (self.script_upload_path, count,
- mount_obj.mountpoint))
+ "--num-of-files 5 %s" % (
+ sys.version_info.major, self.script_upload_path, count,
+ mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, cmd,
user=mount_obj.user)
all_mounts_procs.append(proc)