summaryrefslogtreecommitdiffstats
path: root/tests/functional/snapshot
diff options
context:
space:
mode:
authorNigel Babu <nigelb@redhat.com>2018-03-05 15:49:23 +0530
committerNigel Babu <nigelb@redhat.com>2018-03-27 16:05:15 +0530
commitfb5145be2db1a7c96b008af8a40e3b7b18df9673 (patch)
tree3ca087e0996bfd975e97b4f0235421a37d2e4767 /tests/functional/snapshot
parent8804c9499e9ed0d37823dc55d03eb7792907cf0b (diff)
Fix up coding style issues in tests
Change-Id: I14609030983d4485dbce5a4ffed1e0353e3d1bc7
Diffstat (limited to 'tests/functional/snapshot')
-rw-r--r--tests/functional/snapshot/test_256_snapshots.py (renamed from tests/functional/snapshot/test_validate_snapshot_256.py)24
-rw-r--r--tests/functional/snapshot/test_auto_delete.py16
-rw-r--r--tests/functional/snapshot/test_create_brick_down.py (renamed from tests/functional/snapshot/test_snap_create_brickdown.py)37
-rw-r--r--tests/functional/snapshot/test_snapshot_create.py (renamed from tests/functional/snapshot/test_validate_snapshot_create.py)45
-rw-r--r--tests/functional/snapshot/test_snapshot_restore.py (renamed from tests/functional/snapshot/test_validate_snapshot_restore.py)28
5 files changed, 74 insertions, 76 deletions
diff --git a/tests/functional/snapshot/test_validate_snapshot_256.py b/tests/functional/snapshot/test_256_snapshots.py
index a52f2baf6..f3e6e4b0e 100644
--- a/tests/functional/snapshot/test_validate_snapshot_256.py
+++ b/tests/functional/snapshot/test_256_snapshots.py
@@ -16,7 +16,6 @@
"""
Description : The purpose of this test is to validate create snap>256
-
"""
from glusto.core import Glusto as g
@@ -27,9 +26,8 @@ from glustolibs.io.utils import validate_io_procs, get_mounts_stat
from glustolibs.gluster.snap_ops import get_snap_list, snap_delete_all
-@runs_on([['distributed'], ['replicated', 'distributed-replicated',
- 'dispersed', 'distributed-dispersed'],
- ['glusterfs', 'nfs', 'cifs']])
+@runs_on([['distributed', 'replicated', 'distributed-replicated', 'dispersed',
+ 'distributed-dispersed'], ['glusterfs', 'nfs', 'cifs']])
class SanpCreate256(GlusterBaseClass):
"""
Test for snapshot create for max 256
@@ -59,7 +57,7 @@ class SanpCreate256(GlusterBaseClass):
"file_dir_ops.py")
ret = upload_scripts(cls.clients, script_local_path)
if not ret:
- raise ExecutionError("Failed to upload IO scripts to clients %s",
+ raise ExecutionError("Failed to upload IO scripts to clients %s" %
cls.clients)
g.log.info("Successfully uploaded IO scripts to clients %s",
cls.clients)
@@ -74,7 +72,7 @@ class SanpCreate256(GlusterBaseClass):
volume_create_force=True)
if not ret:
raise ExecutionError("Failed to setup and mount volume")
- g.log.info("Volume %s has been setup successfully" % self.volname)
+ g.log.info("Volume %s has been setup successfully", self.volname)
def tearDown(self):
"""
@@ -139,13 +137,13 @@ class SanpCreate256(GlusterBaseClass):
# Create 256 snaps
for i in range(1, 257, 1):
- cmd_str = "gluster snapshot create %s %s %s" % (
- "snapy%s" % i, self.volname, "no-timestamp")
- ret = g.run(self.mnode, cmd_str)
- self.assertTrue(ret, ("Failed to create snapshot for %s"
- % self.volname))
- g.log.info("Snapshot %s created successfully for volume %s"
- % ("snapy%s" % i, self.volname))
+ cmd_str = "gluster snapshot create %s %s %s" % (
+ "snapy%s" % i, self.volname, "no-timestamp")
+ ret = g.run(self.mnode, cmd_str)
+ self.assertTrue(ret, ("Failed to create snapshot for %s"
+ % self.volname))
+ g.log.info("Snapshot %s created successfully for volume %s",
+ "snapy%s" % i, self.volname)
# Check for no. of snaps using snap_list it should be 256
snap_list = get_snap_list(self.mnode)
diff --git a/tests/functional/snapshot/test_auto_delete.py b/tests/functional/snapshot/test_auto_delete.py
index a9db5dd4f..db8a50f0e 100644
--- a/tests/functional/snapshot/test_auto_delete.py
+++ b/tests/functional/snapshot/test_auto_delete.py
@@ -47,7 +47,7 @@ class DeleteSnapTests(GlusterBaseClass):
ret = self.setup_volume()
if not ret:
raise ExecutionError("Failed to setup volume %s" % self.volname)
- g.log.info("Volume %s has been setup successfully" % self.volname)
+ g.log.info("Volume %s has been setup successfully", self.volname)
# enabling auto-delete
cmd = "gluster snapshot config auto-delete enable"
@@ -62,7 +62,7 @@ class DeleteSnapTests(GlusterBaseClass):
self.assertTrue(ret, ("Failed to set snap-max-hardlimit"
"config option for volume %s" % self.volname))
g.log.info("snap-max-hardlimit config option Successfully set for"
- "volume %s" % self.volname)
+ "volume %s", self.volname)
# Validating max-hard-limit
hardlimit = get_snap_config(self.mnode)
@@ -107,13 +107,13 @@ class DeleteSnapTests(GlusterBaseClass):
self.assertEqual(ret, 0, ("Failed to list snapshot of volume %s"
% self.volname))
g.log.info("Total number of snapshots created after auto-delete"
- "enabled is %s" % out)
+ "enabled is %s", out)
if out != 8:
g.log.info("Failed to validate snapshots with expected"
"number of snapshots")
g.log.info("Snapshot Validation Successful")
- g.log.info("Snapshot list command for volume %s was successful"
- % self.volname)
+ g.log.info("Snapshot list command for volume %s was successful",
+ self.volname)
def tearDown(self):
# Calling GlusterBaseClass tearDown
@@ -130,8 +130,8 @@ class DeleteSnapTests(GlusterBaseClass):
ret = snap_delete_all(self.mnode)
self.assertTrue(ret, ("Failed to delete snapshot of volume"
"%s" % self.volname))
- g.log.info("Successfully deleted snapshots of volume %s"
- % self.volname)
+ g.log.info("Successfully deleted snapshots of volume %s",
+ self.volname)
# setting back default max-soft-limit to 90%
option = {'snap-max-soft-limit': '90'}
@@ -144,4 +144,4 @@ class DeleteSnapTests(GlusterBaseClass):
ret = self.cleanup_volume()
if not ret:
raise ExecutionError("Failed to Cleanup Volume")
- g.log.info("Cleanup volume %s Completed Successfully" % self.volname)
+ g.log.info("Cleanup volume %s Completed Successfully", self.volname)
diff --git a/tests/functional/snapshot/test_snap_create_brickdown.py b/tests/functional/snapshot/test_create_brick_down.py
index 0f6d68dcd..529c39a3d 100644
--- a/tests/functional/snapshot/test_snap_create_brickdown.py
+++ b/tests/functional/snapshot/test_create_brick_down.py
@@ -16,7 +16,6 @@
"""
Description:
-
Test Cases in this module tests for
creating snapshot when the bricks are
down.
@@ -51,10 +50,10 @@ class CreateSnapwhenBricksareDown(GlusterBaseClass):
ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
if not ret:
raise ExecutionError("Failed to setup volume %s" % self.volname)
- g.log.info("Volume %s has been setup successfully" % self.volname)
+ g.log.info("Volume %s has been setup successfully", self.volname)
def test_create_snap_bricks(self):
- """
+ """
1. get brick list
2. check all bricks are online
3. Selecting one brick randomly to bring it offline
@@ -68,9 +67,9 @@ class CreateSnapwhenBricksareDown(GlusterBaseClass):
bricks_list = []
# get the bricks from the volume
- g.log.info("Fetching bricks for the volume : %s" % self.volname)
+ g.log.info("Fetching bricks for the volume : %s", self.volname)
bricks_list = get_all_bricks(self.mnode, self.volname)
- g.log.info("Brick List : %s" % bricks_list)
+ g.log.info("Brick List : %s", bricks_list)
# check all bricks are online
g.log.info("Verifying all bricks are online or not.....")
@@ -82,16 +81,16 @@ class CreateSnapwhenBricksareDown(GlusterBaseClass):
# Selecting one brick randomly to bring it offline
g.log.info("Selecting one brick randomly to bring it offline")
brick_to_bring_offline = random.choice(bricks_list)
- g.log.info("Brick to bring offline:%s " % brick_to_bring_offline)
+ g.log.info("Brick to bring offline:%s ", brick_to_bring_offline)
ret = bring_bricks_offline(self.volname, brick_to_bring_offline,
None)
self.assertTrue(ret, "Failed to bring the bricks offline")
- g.log.info("Randomly Selected brick: %s" % brick_to_bring_offline)
+ g.log.info("Randomly Selected brick: %s", brick_to_bring_offline)
# get brick list
- g.log.info("Fetching bricks for the volume : %s" % self.volname)
+ g.log.info("Fetching bricks for the volume : %s", self.volname)
bricks_list = get_all_bricks(self.mnode, self.volname)
- g.log.info("Brick List : %s" % bricks_list)
+ g.log.info("Brick List : %s", bricks_list)
# check all bricks are online
g.log.info("Verifying all bricks are online or not.....")
@@ -101,38 +100,38 @@ class CreateSnapwhenBricksareDown(GlusterBaseClass):
g.log.info("All bricks are online.")
# get the bricks for the volume
- g.log.info("Fetching bricks for the volume : %s" % self.volname)
+ g.log.info("Fetching bricks for the volume : %s", self.volname)
bricks_list = get_all_bricks(self.mnode, self.volname)
- g.log.info("Brick List : %s" % bricks_list)
+ g.log.info("Brick List : %s", bricks_list)
# Offline Bricks list
offbricks = get_offline_bricks_list(self.mnode, self.volname)
- g.log.info("Bricks Offline: %s" % offbricks)
+ g.log.info("Bricks Offline: %s", offbricks)
# Online Bricks list
onbricks = get_online_bricks_list(self.mnode, self.volname)
- g.log.info("Bricks Online: %s" % onbricks)
+ g.log.info("Bricks Online: %s", onbricks)
# Create snapshot of volume
ret = snap_create(self.mnode, self.volname, "snap1",
False, "Description with $p3c1al characters!")
self.assertTrue(ret, ("Failed to create snapshot snap1"))
- g.log.info("Snapshot snap1 of volume %s created Successfully"
- % (self.volname))
+ g.log.info("Snapshot snap1 of volume %s created Successfully",
+ self.volname)
# Volume status
ret = get_volume_info(self.mnode, self.volname)
self.assertTrue(ret, ("Failed to perform gluster volume"
"info on volume %s"
% self.volname))
- g.log.info("Gluster volume info on volume %s is successful"
- % self.volname)
+ g.log.info("Gluster volume info on volume %s is successful",
+ self.volname)
# snapshot list
ret = snap_list(self.mnode)
self.assertTrue(ret, ("Failed to list snapshot of volume %s"
% self.volname))
- g.log.info("Snapshot list command for volume %s was successful"
- % self.volname)
+ g.log.info("Snapshot list command for volume %s was successful",
+ self.volname)
def tearDown(self):
# Calling GlusterBaseClass tearDown
diff --git a/tests/functional/snapshot/test_validate_snapshot_create.py b/tests/functional/snapshot/test_snapshot_create.py
index f5e3297d3..078dc956f 100644
--- a/tests/functional/snapshot/test_validate_snapshot_create.py
+++ b/tests/functional/snapshot/test_snapshot_create.py
@@ -67,7 +67,7 @@ class SnapCreate(GlusterBaseClass):
"file_dir_ops.py")
ret = upload_scripts(cls.clients, script_local_path)
if not ret:
- raise ExecutionError("Failed to upload IO scripts to clients %s",
+ raise ExecutionError("Failed to upload IO scripts to clients %s" %
cls.clients)
g.log.info("Successfully uploaded IO scripts to clients %s",
cls.clients)
@@ -82,7 +82,7 @@ class SnapCreate(GlusterBaseClass):
volume_create_force=True)
if not ret:
raise ExecutionError("Failed to setup and mount volume")
- g.log.info("Volume %s has been setup successfully" % self.volname)
+ g.log.info("Volume %s has been setup successfully", self.volname)
def tearDown(self):
"""
@@ -107,26 +107,27 @@ class SnapCreate(GlusterBaseClass):
GlusterBaseClass.tearDownClass.im_func(cls)
def test_validate_snaps_create(self):
- # Creating snapshot using gluster snapshot create <snap1> <vol-name>
+ """
+ Creating snapshot using gluster snapshot create <snap1> <vol-name>
+ """
cmd_str = "gluster snapshot create %s %s" % ("snap1", self.volname)
ret = g.run(self.mnode, cmd_str)
self.assertTrue(ret, ("Failed to create snapshot for %s"
% self.volname))
- g.log.info("Snapshot snap1 created successfully for volume %s"
- % (self.volname))
+ g.log.info("Snapshot snap1 created successfully for volume %s",
+ self.volname)
- """ Create snapshot of volume using
- -- gluster snapshot create <snap2> <vol-name(s)> [description
- <description with words and quotes>]
- """
+ # Create snapshot of volume using
+ # -- gluster snapshot create <snap2> <vol-name(s)> [description
+ # <description with words and quotes>]
desc = 'description this is a snap with "snap2" name and description'
cmd_str = ("gluster snapshot create %s %s %s"
% ("snap2", self.volname, desc))
ret = g.run(self.mnode, cmd_str)
self.assertTrue(ret, ("Failed to create snapshot for %s"
% self.volname))
- g.log.info("Snapshot snap2 created successfully for volume %s"
- % (self.volname))
+ g.log.info("Snapshot snap2 created successfully for volume %s",
+ (self.volname))
# Create one more snapshot of volume using force
cmd_str = ("gluster snapshot create %s %s %s"
@@ -134,8 +135,8 @@ class SnapCreate(GlusterBaseClass):
ret = g.run(self.mnode, cmd_str)
self.assertTrue(ret, ("Failed to create snapshot for %s"
% self.volname))
- g.log.info("Snapshot snap3 created successfully for volume %s"
- % (self.volname))
+ g.log.info("Snapshot snap3 created successfully for volume %s",
+ (self.volname))
# Create one more snapshot of volume using no-timestamp option
cmd_str = ("gluster snapshot create %s %s %s"
@@ -143,8 +144,8 @@ class SnapCreate(GlusterBaseClass):
ret = g.run(self.mnode, cmd_str)
self.assertTrue(ret, ("Failed to create snapshot for %s"
% self.volname))
- g.log.info("Snapshot snap4 created successfully for volume %s"
- % (self.volname))
+ g.log.info("Snapshot snap4 created successfully for volume %s",
+ (self.volname))
# Delete all snaps
ret, _, _ = snap_delete_all(self.mnode)
@@ -171,13 +172,13 @@ class SnapCreate(GlusterBaseClass):
# Create 5 snaps while IO is in progress
for i in range(0, 5):
- cmd_str = "gluster snapshot create %s %s %s" % (
- "snapy%s" % i, self.volname, "no-timestamp")
- ret = g.run(self.mnode, cmd_str)
- self.assertTrue(ret, ("Failed to create snapshot for %s"
- % self.volname))
- g.log.info("Snapshot %s created successfully for volume %s"
- % ("snapy%s" % i, self.volname))
+ cmd_str = "gluster snapshot create %s %s %s" % (
+ "snapy%s" % i, self.volname, "no-timestamp")
+ ret = g.run(self.mnode, cmd_str)
+ self.assertTrue(ret, ("Failed to create snapshot for %s"
+ % self.volname))
+ g.log.info("Snapshot %s created successfully for volume %s",
+ "snapy%s" % i, self.volname)
# Validate IO
g.log.info("Validating IO's")
diff --git a/tests/functional/snapshot/test_validate_snapshot_restore.py b/tests/functional/snapshot/test_snapshot_restore.py
index 5ac45182e..cbec67e04 100644
--- a/tests/functional/snapshot/test_validate_snapshot_restore.py
+++ b/tests/functional/snapshot/test_snapshot_restore.py
@@ -15,8 +15,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""
-Description : The purpose of this test is to validate restore of a snapshot.
-
+The purpose of this test is to validate restore of a snapshot.
"""
from glusto.core import Glusto as g
@@ -36,7 +35,7 @@ from glustolibs.gluster.snap_ops import (snap_create,
@runs_on([['distributed-replicated', 'distributed-dispersed'],
- ['glusterfs']])
+ ['glusterfs']])
class SnapRestore(GlusterBaseClass):
"""
Test for snapshot restore
@@ -72,7 +71,7 @@ class SnapRestore(GlusterBaseClass):
"file_dir_ops.py")
ret = upload_scripts(cls.clients, script_local_path)
if not ret:
- raise ExecutionError("Failed to upload IO scripts to clients %s",
+ raise ExecutionError("Failed to upload IO scripts to clients %s" %
cls.clients)
g.log.info("Successfully uploaded IO scripts to clients %s",
cls.clients)
@@ -87,7 +86,7 @@ class SnapRestore(GlusterBaseClass):
volume_create_force=True)
if not ret:
raise ExecutionError("Failed to setup and mount volume")
- g.log.info("Volume %s has been setup successfully" % self.volname)
+ g.log.info("Volume %s has been setup successfully", self.volname)
def tearDown(self):
"""
@@ -112,6 +111,7 @@ class SnapRestore(GlusterBaseClass):
GlusterBaseClass.tearDownClass.im_func(cls)
def test_validate_snaps_restore(self):
+ # pylint: disable=too-many-statements
# Start IO on all mounts.
all_mounts_procs = []
count = 1
@@ -154,20 +154,20 @@ class SnapRestore(GlusterBaseClass):
'autoDelete': 'disable'}}
ret = set_snap_config(self.mnode, option_before_restore)
self.assertTrue(ret, ("Failed to set vol option on %s"
- % self.volname))
- g.log.info("Volume options for%s is set successfully" % self.volname)
+ % self.volname))
+ g.log.info("Volume options for%s is set successfully", self.volname)
# Get brick list befor taking snap_restore
bricks_before_snap_restore = get_all_bricks(self.mnode, self.volname)
g.log.info("Brick List before snap restore "
- "volume: %s" % bricks_before_snap_restore)
+ "volume: %s", bricks_before_snap_restore)
# Creating snapshot
ret = snap_create(self.mnode, self.volname, "snap1")
self.assertTrue(ret, ("Failed to create snapshot for %s"
% self.volname))
- g.log.info("Snapshot snap1 created successfully for volume %s"
- % (self.volname))
+ g.log.info("Snapshot snap1 created successfully for volume %s",
+ self.volname)
# Again start IO on all mounts.
all_mounts_procs = []
@@ -202,7 +202,7 @@ class SnapRestore(GlusterBaseClass):
# Reset volume to make sure volume options will reset
ret = volume_reset(self.mnode, self.volname, force=False)
self.assertTrue(ret, ("Failed to reset %s" % self.volname))
- g.log.info("Reset Volume %s is Successful" % self.volname)
+ g.log.info("Reset Volume %s is Successful", self.volname)
# Removing one brick
g.log.info("Starting volume shrink")
@@ -235,7 +235,7 @@ class SnapRestore(GlusterBaseClass):
# Get brick list post restore
bricks_after_snap_restore = get_all_bricks(self.mnode, self.volname)
g.log.info("Brick List after snap restore "
- "volume: %s" % bricks_after_snap_restore)
+ "volume: %s", bricks_after_snap_restore)
# Compare brick_list
self.assertNotEqual(bricks_before_snap_restore,
bricks_after_snap_restore,
@@ -245,8 +245,8 @@ class SnapRestore(GlusterBaseClass):
ret = snap_create(self.mnode, self.volname, "snap2")
self.assertTrue(ret, ("Failed to create snapshot for %s"
% self.volname))
- g.log.info("Snapshot snap2 created successfully for volume %s"
- % (self.volname))
+ g.log.info("Snapshot snap2 created successfully for volume %s",
+ self.volname)
# Again start IO on all mounts after restore
all_mounts_procs = []