test: Test for OOM condition in a loop

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2017-10-23 15:42:59 -07:00
parent 7ab9c55a12
commit 56cda43444

View file

@ -767,10 +767,16 @@ function teardown() {
echo "$output" echo "$output"
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
# Wait for container to OOM # Wait for container to OOM
sleep 100 attempt=0
while [ $attempt -le 100 ]; do
attempt=$((attempt+1))
run crioctl ctr status --id "$ctr_id" run crioctl ctr status --id "$ctr_id"
echo "$output" echo "$output"
[ "$status" -eq 0 ] if [[ "$output" =~ "OOMKilled" ]]; then
break
fi
sleep 10
done
[[ "$output" =~ "OOMKilled" ]] [[ "$output" =~ "OOMKilled" ]]
run crioctl pod stop --id "$pod_id" run crioctl pod stop --id "$pod_id"
echo "$output" echo "$output"