From 43b1e5b72704f77bc9f31d31b1a45947655ec14d Mon Sep 17 00:00:00 2001 From: Naga Ravi Chaitanya Elluri Date: Thu, 28 Oct 2021 10:48:21 -0400 Subject: [PATCH] Remove item only when the list is not empty This commit fixes the case where the fault injected containers take longer time to recover as the current checks are bombing out if the list is empty. --- kraken/pod_scenarios/setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kraken/pod_scenarios/setup.py b/kraken/pod_scenarios/setup.py index 7eceb3ac..5b028bab 100644 --- a/kraken/pod_scenarios/setup.py +++ b/kraken/pod_scenarios/setup.py @@ -182,8 +182,9 @@ def check_failed_containers(killed_container_list, wait_time): if statuses["name"] == killed_container[2]: if str(statuses["ready"]).lower() == "true": container_ready.append(killed_container) - for item in container_ready: - killed_container_list = killed_container_list.remove(item) + if len(container_ready) != 0: + for item in container_ready: + killed_container_list = killed_container_list.remove(item) if killed_container_list is None or len(killed_container) == 0: return [] timer += 5