summaryrefslogtreecommitdiffstats
path: root/tests/functional/heketi/test_disabling_device.py
diff options
context:
space:
mode:
authorValerii Ponomarov <vponomar@redhat.com>2019-06-24 01:29:41 +0530
committervponomar <vponomar@redhat.com>2019-07-11 09:13:40 +0000
commit32724906d1fd5fd09759e1daf927594461c26d5e (patch)
treeb6744bd1f0b1364e43810c343a873f6022e3e575 /tests/functional/heketi/test_disabling_device.py
parent1ef65c168d3b45a5af5d263ff3403263810a42d8 (diff)
Make Heketi commands run on a Heketi POD when main command fails
It happens that heketi client located out of the Heketi POD may fail not reaching the server side. So, add back-up approach where we run Heketi commands on a Heketi POD when main commands fail. Change-Id: Ie6ae5be82082f34426f9288b02575e3abd4940f5
Diffstat (limited to 'tests/functional/heketi/test_disabling_device.py')
-rw-r--r--tests/functional/heketi/test_disabling_device.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/functional/heketi/test_disabling_device.py b/tests/functional/heketi/test_disabling_device.py
index c8ec026b..27e50190 100644
--- a/tests/functional/heketi/test_disabling_device.py
+++ b/tests/functional/heketi/test_disabling_device.py
@@ -2,7 +2,6 @@ from glusto.core import Glusto as g
from glustolibs.gluster.volume_ops import get_volume_info
from openshiftstoragelibs import baseclass
-from openshiftstoragelibs import exceptions
from openshiftstoragelibs import heketi_ops
from openshiftstoragelibs import podcmd
@@ -77,9 +76,10 @@ class TestDisableHeketiDevice(baseclass.BaseClass):
self.assertTrue(out, "Failed to get device info %s" % device_id)
g.log.info("Successfully retrieved device info %s" % device_id)
name = out["name"]
- if out["state"].lower().strip() != "offline":
- raise exceptions.ExecutionError(
- "Device %s is not in offline state." % name)
+ self.assertEqual(
+ out["state"].lower().strip(), "offline",
+ "Device %s is not in offline state." % name
+ )
g.log.info("Device %s is now offine" % name)
# Try to create heketi volume
@@ -88,7 +88,7 @@ class TestDisableHeketiDevice(baseclass.BaseClass):
out = heketi_ops.heketi_volume_create(
self.heketi_client_node, self.heketi_server_url, 1,
json=True)
- except exceptions.ExecutionError:
+ except AssertionError:
g.log.info("Volume was not created as expected.")
else:
self.addCleanup(
@@ -111,9 +111,10 @@ class TestDisableHeketiDevice(baseclass.BaseClass):
self.assertTrue(out, ("Failed to get device info %s" % device_id))
g.log.info("Successfully retrieved device info %s" % device_id)
name = out["name"]
- if out["state"] != "online":
- raise exceptions.ExecutionError(
- "Device %s is not in online state." % name)
+ self.assertEqual(
+ out["state"], "online",
+ "Device %s is not in online state." % name
+ )
# Create heketi volume of size
out = heketi_ops.heketi_volume_create(