From 56cda434444c851636da99020cce912b3f8c457f Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 23 Oct 2017 15:42:59 -0700 Subject: [PATCH] test: Test for OOM condition in a loop Signed-off-by: Mrunal Patel --- test/ctr.bats | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/ctr.bats b/test/ctr.bats index 2f225187..90f42b68 100644 --- a/test/ctr.bats +++ b/test/ctr.bats @@ -767,10 +767,16 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] # Wait for container to OOM - sleep 100 - run crioctl ctr status --id "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] + attempt=0 + while [ $attempt -le 100 ]; do + attempt=$((attempt+1)) + run crioctl ctr status --id "$ctr_id" + echo "$output" + if [[ "$output" =~ "OOMKilled" ]]; then + break + fi + sleep 10 + done [[ "$output" =~ "OOMKilled" ]] run crioctl pod stop --id "$pod_id" echo "$output"