test: Fix oom test by changing to a sleep loop
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
0413088ffb
commit
e3e9936f67
1 changed files with 23 additions and 5 deletions
|
@ -6,6 +6,17 @@ function teardown() {
|
|||
cleanup_test
|
||||
}
|
||||
|
||||
function contains () {
|
||||
string="$1"
|
||||
substring="$2"
|
||||
if test "${string#*$substring}" != "$string"
|
||||
then
|
||||
return 0 # $substring is in $string
|
||||
else
|
||||
return 1 # $substring is not in $string
|
||||
fi
|
||||
}
|
||||
|
||||
@test "ctr not found correct error message" {
|
||||
start_crio
|
||||
run crioctl ctr status --id randomid
|
||||
|
@ -715,12 +726,19 @@ function teardown() {
|
|||
run crioctl ctr start --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
# Wait for container to OOM
|
||||
run sleep 10
|
||||
i=0
|
||||
while [ $i -lt 30 ]; do
|
||||
run crioctl ctr status --id "$ctr_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "OOMKilled" ]]
|
||||
if [ contains "$output" "OOMKilled" ]; then
|
||||
break;
|
||||
fi
|
||||
sleep 1
|
||||
i=$((i+1))
|
||||
done
|
||||
[ contains "$output" "OOMKilled" ]
|
||||
[ "$status" -eq 0 ]
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue