Fix race in tty integration test with slow startup
Signed-off-by: Jordan Liggitt <liggitt@google.com>
This commit is contained in:
parent
7496a96825
commit
52951a7c19
|
@ -218,12 +218,16 @@ function wait_for_container() {
|
|||
local attempts=$1
|
||||
local delay=$2
|
||||
local cid=$3
|
||||
# optionally wait for a specific status
|
||||
local wait_for_status="${4:-}"
|
||||
local i
|
||||
|
||||
for ((i = 0; i < attempts; i++)); do
|
||||
runc state $cid
|
||||
if [[ "$status" -eq 0 ]]; then
|
||||
return 0
|
||||
if [[ "${output}" == *"${wait_for_status}"* ]]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
sleep $delay
|
||||
done
|
||||
|
@ -237,12 +241,16 @@ function wait_for_container_inroot() {
|
|||
local attempts=$1
|
||||
local delay=$2
|
||||
local cid=$3
|
||||
# optionally wait for a specific status
|
||||
local wait_for_status="${4:-}"
|
||||
local i
|
||||
|
||||
for ((i = 0; i < attempts; i++)); do
|
||||
ROOT=$4 runc state $cid
|
||||
if [[ "$status" -eq 0 ]]; then
|
||||
return 0
|
||||
if [[ "${output}" == *"${wait_for_status}"* ]]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
sleep $delay
|
||||
done
|
||||
|
|
|
@ -205,7 +205,7 @@ EOF
|
|||
__runc run test_busybox
|
||||
) &
|
||||
|
||||
wait_for_container 15 1 test_busybox
|
||||
wait_for_container 15 1 test_busybox running
|
||||
testcontainer test_busybox running
|
||||
|
||||
# Kill the container.
|
||||
|
|
Loading…
Reference in New Issue