summaryrefslogtreecommitdiffstats
path: root/cns-libs
diff options
context:
space:
mode:
authorSaravanakumar Arumugam <sarumuga@redhat.com>2018-10-03 12:27:00 +0530
committervamahaja <vamahaja@redhat.com>2018-12-19 12:05:02 +0530
commit5d25e0354a007df3c40607f9c5884d56755cac60 (patch)
treea0ff137bb0b6b173d33329ab7378856256ae14f7 /cns-libs
parent78d7a913a49d388d80f42e367f2cb9ff6dc5ca20 (diff)
[CNS-451]: Test to verify volumes post node reboot
Change-Id: I2fc6f2ee9dd0c38519ab560e9d1c1a9672940843 Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com> Signed-off-by: vamahaja <vamahaja@redhat.com>
Diffstat (limited to 'cns-libs')
-rw-r--r--cns-libs/cnslibs/cns/cns_baseclass.py5
-rw-r--r--cns-libs/cnslibs/common/command.py7
2 files changed, 8 insertions, 4 deletions
diff --git a/cns-libs/cnslibs/cns/cns_baseclass.py b/cns-libs/cnslibs/cns/cns_baseclass.py
index badac6b8..f497beb7 100644
--- a/cns-libs/cnslibs/cns/cns_baseclass.py
+++ b/cns-libs/cnslibs/cns/cns_baseclass.py
@@ -195,7 +195,8 @@ class CnsBaseClass(unittest.TestCase):
def create_and_wait_for_pvcs(self, pvc_size=1,
pvc_name_prefix="autotests-pvc",
- pvc_amount=1, sc_name=None):
+ pvc_amount=1, sc_name=None,
+ timeout=120, wait_step=3):
node = self.ocp_client[0]
# Create storage class if not specified
@@ -218,7 +219,7 @@ class CnsBaseClass(unittest.TestCase):
# Wait for PVCs to be in bound state
try:
for pvc_name in pvc_names:
- verify_pvc_status_is_bound(node, pvc_name)
+ verify_pvc_status_is_bound(node, pvc_name, timeout, wait_step)
finally:
reclaim_policy = oc_get_custom_resource(
node, 'sc', ':.reclaimPolicy', sc_name)[0]
diff --git a/cns-libs/cnslibs/common/command.py b/cns-libs/cnslibs/common/command.py
index e2c41545..06912915 100644
--- a/cns-libs/cnslibs/common/command.py
+++ b/cns-libs/cnslibs/common/command.py
@@ -10,11 +10,14 @@ def cmd_run(cmd, hostname, raise_on_error=True):
raise_on_error (bool): defines whether we should raise exception
in case command execution failed.
Returns:
- str: Stripped shell command's stdout value.
+ str: Stripped shell command's stdout value if not None.
"""
ret, out, err = g.run(hostname, cmd, "root")
if raise_on_error:
msg = ("Failed to execute command '%s' on '%s' node. Got non-zero "
"return code '%s'. Err: %s" % (cmd, hostname, ret, err))
assert int(ret) == 0, msg
- return out.strip()
+
+ out = out.strip() if out else out
+
+ return out