Skip to content

Commit

Permalink
test: fix flaky test case test_volume_reattach_after_engine_sigkill
Browse files Browse the repository at this point in the history
the pod we're waiting could be terminated and recreated,
so reading the pod could raise not found exception.
wrapping it in try/except to make the waiting can continue.

Signed-off-by: Yang Chiu <yang.chiu@suse.com>
(cherry picked from commit 2832bb3)
  • Loading branch information
yangchiu authored and innobead committed Jan 9, 2024
1 parent 7340087 commit ef3370f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions manager/integration/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4920,11 +4920,14 @@ def wait_for_pod_restart(core_api, pod_name, namespace="default"):
def wait_for_pod_phase(core_api, pod_name, pod_phase, namespace="default"):
is_phase = False
for _ in range(RETRY_COUNTS):
pod = core_api.read_namespaced_pod(name=pod_name,
namespace=namespace)
if pod.status.phase == pod_phase:
is_phase = True
break
try:
pod = core_api.read_namespaced_pod(name=pod_name,
namespace=namespace)
if pod.status.phase == pod_phase:
is_phase = True
break
except Exception as e:
print(f"Waiting for pod {pod_name} {pod_phase} failed: {e}")

time.sleep(RETRY_INTERVAL_LONG)
assert is_phase
Expand Down

0 comments on commit ef3370f

Please sign in to comment.