summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinayak Papnoi <vpapnoi@redhat.com>2019-06-05 11:59:29 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-06-06 13:10:24 +0000
commitc14b8b91668d31c3c80a28da38f8fdd9913b39d6 (patch)
tree4a70f92a4d19ebba47c0a3fe4dcbfebaa32cdd81
parent5739948809ffb7df3c276c30ca31c54340b6eb3f (diff)
[Snapshot] Fixing Jira ticket RHGSQE-233
Removing 'ExecutionError' raised inside the test case function. Adding the description for the test case function. Fixing the typo errors and various cosmetic changes. Change-Id: Ica505417f482c7a622be5da70c1053913cf3052c Signed-off-by: Vinayak Papnoi <vpapnoi@redhat.com>
-rw-r--r--tests/functional/snapshot/test_activate_deactivate.py122
1 files changed, 66 insertions, 56 deletions
diff --git a/tests/functional/snapshot/test_activate_deactivate.py b/tests/functional/snapshot/test_activate_deactivate.py
index 73dd30c..8a75509 100644
--- a/tests/functional/snapshot/test_activate_deactivate.py
+++ b/tests/functional/snapshot/test_activate_deactivate.py
@@ -18,7 +18,7 @@
Description:
The purpose of this test case is to validate Snapshot
activation and deactivation.
- Pre-Activate, After Activate and After Deactivate
+ Pre-Activate, Post-Activate and Post-Deactivate
"""
from glusto.core import Glusto as g
from glustolibs.gluster.exceptions import ExecutionError
@@ -80,91 +80,101 @@ class TestActivateDeactivate(GlusterBaseClass):
# pylint: disable=too-many-branches, too-many-statements
"""
Verifying Snapshot activation/deactivation functionality.
+
+ * Create Snapshot
+ * Validate snapshot info before activation
+ * Validate snapshot status before activation
+ * Activate snapshot
+ * Validate snapshot info after activation
+ * Validate snapshot status after activation
+ * Deactivate snapshot
+ * Validate snapshot info after deactivation
+ * Validate snapshot status after deactivation
"""
- snap_name = 'snap_%s' % self.volname
+
# Create Snapshot
+ snap_name = 'snap_%s' % self.volname
g.log.info("Starting to Create Snapshot %s", snap_name)
- ret, _, _ = snap_create(self.mnode, self.volname,
- snap_name)
- self.assertEqual(ret, 0, "Snapshot Creation failed"
- " for %s" % snap_name)
- g.log.info("Snapshot %s of volume %s created"
- " successfully", snap_name, self.volname)
+ ret, _, _ = snap_create(self.mnode, self.volname, snap_name)
+ self.assertEqual(ret, 0, ("Snapshot Creation failed for %s",
+ snap_name))
+ g.log.info("Successfully created Snapshot %s for volume %s",
+ snap_name, self.volname)
# Validate Snapshot Info Before Activation
+ g.log.info("Validating 'snapshot info' in 'stopped' state before "
+ "activating the snapshot")
ret = get_snap_info_by_snapname(self.mnode, snap_name)
- if ret is None:
- raise ExecutionError("Failed to Fetch Snapshot"
- "info for %s" % snap_name)
- g.log.info("Snapshot info Success"
- "for %s", ret['snapVolume']['status'])
- if ret['snapVolume']['status'] != 'Stopped':
- raise ExecutionError("Unexpected: "
- "Snapshot %s Status is in "
- "Started State" % snap_name)
- g.log.info("Expected: Snapshot is in Stopped state "
- "as it is not Activated")
+ self.assertIsNotNone(ret, ("Failed to Fetch Snapshot info for %s",
+ snap_name))
+ g.log.info("Snapshot info Success for %s", ret['snapVolume']['status'])
+ self.assertEqual(ret['snapVolume']['status'], 'Stopped',
+ ("Unexpected: Snapshot %s Status is in Started state",
+ snap_name))
+ g.log.info("Expected: Snapshot is in Stopped state as it is "
+ "not Activated")
# Validate Snapshot Status Before Activation
+ g.log.info("Validating 'snapshot status' in 'stopped' state before "
+ "activating the snapshot")
ret = get_snap_status_by_snapname(self.mnode, snap_name)
- if ret is None:
- raise ExecutionError("Failed to Fetch Snapshot"
- "status for %s" % snap_name)
+ self.assertIsNotNone(ret, ("Failed to Fetch Snapshot status for %s",
+ snap_name))
g.log.info("Snapshot Status Success for %s", snap_name)
for brick in ret['volume']['brick']:
- if brick['pid'] != 'N/A':
- raise ExecutionError("Brick Pid %s available for %s"
- % brick['pid'], brick['path'])
- g.log.info("Deactivated Snapshot Brick PID N/A as Expected")
+ self.assertEqual(brick['pid'], 'N/A',
+ ("Unexpected: Brick Pid '%s' is available for %s",
+ brick['pid'], brick['path']))
+ g.log.info("Expected: Deactivated Snapshot Brick PID is 'N/A'")
# Activate Snapshot
g.log.info("Starting to Activate %s", snap_name)
ret, _, _ = snap_activate(self.mnode, snap_name)
- self.assertEqual(ret, 0, "Snapshot Activation Failed"
- " for %s" % snap_name)
+ self.assertEqual(ret, 0, ("Snapshot Activation Failed for %s",
+ snap_name))
g.log.info("Snapshot %s Activated Successfully", snap_name)
# Validate Snapshot Info After Activation
- g.log.info("Validate snapshot info")
+ g.log.info("Validating 'snapshot info' in 'started' state after"
+ " activating the snapshot")
snap_info = get_snap_info_by_snapname(self.mnode, snap_name)
self.assertEqual(snap_info['snapVolume']['status'], "Started",
- "Failed to Fetch Snapshot"
- "info after activate "
- "for %s" % snap_name)
- g.log.info("Snapshot info Success ")
+ ("Failed to Fetch Snapshot info after activate "
+ "for %s", snap_name))
+ g.log.info("Success: Snapshot info in 'started' state")
# Validate Snaphot Status After Activation
- g.log.info("Validate snapshot status")
+ g.log.info("Validating 'snapshot status' in started state after "
+ "activating the snapshot")
ret = get_snap_status_by_snapname(self.mnode, snap_name)
for brick in ret['volume']['brick']:
- self.assertNotEqual(brick['pid'], 'N/A', "Brick Path "
- "%s Not Available "
- "for Activated Snapshot %s"
- % (brick['path'], snap_name))
- g.log.info("Activated Snapshot Brick Path "
- "Available as Expected")
-
- # Validation After Snapshot Deactivate
+ self.assertNotEqual(brick['pid'], 'N/A',
+ ("Brick Path %s Not Available for Activated "
+ "Snapshot %s", (brick['path'], snap_name)))
+ g.log.info("Sucessfully validated Activated Snapshot Brick Path "
+ "Available")
+
+ # Deactivate Snapshot
g.log.info("Starting to Deactivate %s", snap_name)
ret, _, _ = snap_deactivate(self.mnode, snap_name)
- self.assertEqual(ret, 0, "Snapshot Deactivation Failed"
- " for %s" % snap_name)
- g.log.info("Snapshot %s Deactivation Successfully", snap_name)
+ self.assertEqual(ret, 0, ("Snapshot Deactivation Failed for %s",
+ snap_name))
+ g.log.info("Successfully Deactivated Snapshot %s", snap_name)
# Validate Snapshot Info After Deactivation
+ g.log.info("Validating 'snapshot info' in stopped state after "
+ "deactivating the snapshot")
ret = get_snap_info_by_snapname(self.mnode, snap_name)
self.assertEqual(ret['snapVolume']['status'], 'Stopped',
- "Snapshot Status is not "
- "in Stopped State")
- g.log.info("Snapshot is in Stopped state after Deactivation")
+ ("Snapshot Status is not in 'Stopped' State"))
+ g.log.info("Expected: Snapshot is in Stopped state after Deactivation")
- # Validate Snaphot Status After Activation
- g.log.info("Validate snapshot status")
+ # Validate Snaphot Status After Deactivation
+ g.log.info("Validating 'snapshot status' in started state after "
+ "deactivating the snapshot")
ret = get_snap_status_by_snapname(self.mnode, snap_name)
for brick in ret['volume']['brick']:
- self.assertEqual(brick['pid'], 'N/A', "Deactivated "
- "Snapshot Brick "
- "Pid %s available "
- "for %s"
- % (brick['pid'], brick['path']))
- g.log.info("Deactivated Snapshot Brick PID N/A as Expected")
+ self.assertEqual(brick['pid'], 'N/A',
+ ("Deactivated Snapshot Brick Pid %s available "
+ "for %s", brick['pid'], brick['path']))
+ g.log.info("Expected: Deactivated Snapshot Brick PID is 'N/A'")