summaryrefslogtreecommitdiffstats
path: root/tests/functional/glusterd
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-07-05 23:01:11 +0300
committerNigel Babu <nigelb@redhat.com>2018-07-17 04:20:43 +0000
commit23e5ecbdbb4b37c6c6666ff6b2d6d057c266fd15 (patch)
treefab07a381021339ee32c1dd040444a9f04ac1b24 /tests/functional/glusterd
parent02dbb7a68f828863e5b71dc15488e665d484ab6e (diff)
Tests: ensure volume deletion works when intended.
It could have failed without anyone noticing. Added 'xfail' - do we expect to fail in deletion (and changed tests accordingly) On the way, ensure stdout and stderr are logged in case of such failures. Change-Id: Ibdf7a43cadb0393707a6c68c19a664453a971eb1 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'tests/functional/glusterd')
-rw-r--r--tests/functional/glusterd/test_peer_probe.py9
-rw-r--r--tests/functional/glusterd/test_volume_operations.py46
2 files changed, 31 insertions, 24 deletions
diff --git a/tests/functional/glusterd/test_peer_probe.py b/tests/functional/glusterd/test_peer_probe.py
index a3fe5240d..242681343 100644
--- a/tests/functional/glusterd/test_peer_probe.py
+++ b/tests/functional/glusterd/test_peer_probe.py
@@ -226,10 +226,11 @@ class TestPeerProbe(GlusterBaseClass):
g.log.info("Volume %s start with force is success", self.volname)
# Volume delete should fail without stopping volume
- ret = volume_delete(self.servers[2], self.volname)
- self.assertFalse(ret, ("Unexpected Error: Volume deleted "
- "successfully without stopping"
- "volume %s", self.volname))
+ self.assertTrue(
+ volume_delete(self.servers[2], self.volname, xfail=True),
+ "Unexpected Error: Volume deleted "
+ "successfully without stopping volume"
+ )
g.log.info("Expected: volume delete should fail without "
"stopping volume: %s", self.volname)
diff --git a/tests/functional/glusterd/test_volume_operations.py b/tests/functional/glusterd/test_volume_operations.py
index fc8d8b0b6..47807c6f9 100644
--- a/tests/functional/glusterd/test_volume_operations.py
+++ b/tests/functional/glusterd/test_volume_operations.py
@@ -179,11 +179,12 @@ class TestVolumeCreate(GlusterBaseClass):
g.log.info("Stopping a non existing volume is failed")
# Deleting a non existing volume should fail
- ret = volume_delete(self.mnode, "no_vol")
- self.assertTrue(ret, "Expected: It should fail to delete a "
- "non existing volume. Actual:Successfully deleted "
- "a non existing volume")
- g.log.info("Deleting a non existing volume is failed")
+ self.assertTrue(
+ volume_delete(self.mnode, "no_vol", xfail=True),
+ "Expected: It should fail to delete a "
+ "non existing volume. Actual:Successfully deleted "
+ "a non existing volume"
+ )
# Detach a server and try to create volume with node
# which is not in cluster
@@ -220,11 +221,14 @@ class TestVolumeCreate(GlusterBaseClass):
g.log.info("Starting a already started volume is Failed.")
# Deleting a volume without stopping should fail
- ret = volume_delete(self.mnode, self.volname)
- self.assertFalse(ret, ("Expected: It should fail to delete a volume"
- " without stopping. Actual: Successfully "
- "deleted a volume without stopping it"))
- g.log.error("Failed to delete a volume without stopping it")
+ self.assertTrue(
+ volume_delete(self.mnode, self.volname, xfail=True),
+ "Expected: It should fail to delete a volume"
+ " without stopping. Actual: Successfully "
+ "deleted a volume without stopping it"
+ )
+ g.log.info("Expected: volume delete should fail without "
+ "stopping volume: %s", self.volname)
# Stopping a volume should succeed
ret, _, _ = volume_stop(self.mnode, self.volname)
@@ -239,16 +243,18 @@ class TestVolumeCreate(GlusterBaseClass):
g.log.info("Volume stop is failed on already stopped volume")
# Deleting a volume should succeed
- ret = volume_delete(self.mnode, self.volname)
- self.assertTrue(ret, ("Volume delete is failed"))
- g.log.info("Volume delete is success")
-
- # Deleting a non existing volume should fail
- ret = volume_delete(self.mnode, self.volname)
- self.assertTrue(ret, "Expected: It should fail to delete a non "
- "existing volume. Actual:Successfully deleted a "
- "non existing volume")
- g.log.info("Volume delete is failed for non existing volume")
+ self.assertTrue(
+ volume_delete(self.mnode, self.volname),
+ "Volume delete is failed"
+ )
+
+ # Deleting an already deleted volume should fail
+ self.assertTrue(
+ volume_delete(self.mnode, self.volname, xfail=True),
+ "Expected: It should fail to delete an "
+ "already deleted volume. Actual:Successfully "
+ "deleted an already deleted volume"
+ )
# Volume info command should succeed
ret = get_volume_info(self.mnode)