summaryrefslogtreecommitdiffstats
path: root/openshift-storage-libs
diff options
context:
space:
mode:
authorArun Kumar <arukumar@redhat.com>2020-08-03 13:18:26 +0530
committerVaibhav Mahajan <vamahaja@redhat.com>2020-12-11 10:04:08 +0000
commit0189b57b40260e8adc79e5daea3d0e6e5e312c19 (patch)
treec09b55e5204234d6687713ff30639316329403b8 /openshift-storage-libs
parent41ece9c476ef4ba3e553245a31c3cbe1b6808f4b (diff)
[Test] Add TC's to validate elasticsearch pod respin
Change-Id: I2c969b67bb30666a0616919ced39653d9166ef38 Signed-off-by: Arun Kumar <arukumar@redhat.com>
Diffstat (limited to 'openshift-storage-libs')
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index 0ed293d..a228e19 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -465,7 +465,7 @@ def oc_create_tiny_pod_with_volume(hostname, pvc_name, pod_name_prefix='',
def oc_delete(
ocp_node, rtype, name, raise_on_absence=True, collect_logs=False,
- skip_res_validation=True):
+ skip_res_validation=True, is_force=False):
"""Delete an OCP resource by name
Args:
@@ -478,6 +478,7 @@ def oc_delete(
default value: True
collect_logs (bool): Collect logs before deleting resource
skip_res_validation(bool): To validate before deletion of resource.
+ is_force (bool): True for deleting forcefully, default is False
"""
if skip_res_validation and not oc_get_yaml(
ocp_node, rtype, name, raise_on_error=raise_on_absence):
@@ -493,6 +494,10 @@ def oc_delete(
if openshift_version.get_openshift_version() >= '3.11':
cmd.append('--wait=false')
+ # Forcefully delete
+ if is_force:
+ cmd.append("--grace-period 0 --force")
+
command.cmd_run(cmd, hostname=ocp_node)
@@ -1068,7 +1073,7 @@ def wait_for_pod_be_ready(hostname, pod_name,
g.log.info("pod %s is in ready state and is "
"Running" % pod_name)
return True
- elif output[1] == "Error":
+ elif output[1] in ["Error", "CrashBackOffLoop"]:
msg = ("pod %s status error" % pod_name)
g.log.error(msg)
raise exceptions.ExecutionError(msg)