Merge pull request #1433 from avagin/wait_for_container

tests: don't call wait_for_container after synchronous operations
This commit is contained in:
Daniel, Dao Quang Minh 2017-05-05 10:40:20 -05:00 committed by GitHub
commit d37c558a43
15 changed files with 44 additions and 98 deletions

View File

@ -47,7 +47,6 @@ EOF
# run a detached busybox to work with
runc run -d --console-socket $CONSOLE_SOCKET test_cgroups_kmem
[ "$status" -eq 0 ]
wait_for_container 15 1 test_cgroups_kmem
# update kernel memory limit
runc update test_cgroups_kmem --kernel-memory 50331648
@ -67,7 +66,6 @@ EOF
# run a detached busybox to work with
runc run -d --console-socket $CONSOLE_SOCKET test_cgroups_kmem
[ "$status" -eq 0 ]
wait_for_container 15 1 test_cgroups_kmem
# update kernel memory limit
runc update test_cgroups_kmem --kernel-memory 50331648

View File

@ -67,21 +67,33 @@ function teardown() {
# setting terminal and root:readonly: to false
sed -i 's;"terminal": true;"terminal": false;' config.json
sed -i 's;"readonly": true;"readonly": false;' config.json
sed -i 's/"sh"/"sh","-c","while :; do date; sleep 1; done"/' config.json
sed -i 's/"sh"/"sh","-c","for i in `seq 10`; do read xxx || continue; echo ponG $xxx; done"/' config.json
# The following code creates pipes for stdin and stdout.
# CRIU can't handle fifo-s, so we need all these tricks.
fifo=`mktemp -u /tmp/runc-fifo-XXXXXX`
mkfifo $fifo
# stdout
cat $fifo | cat $fifo &
pid=$!
exec 50</proc/$pid/fd/0
exec 51>/proc/$pid/fd/0
# stdin
cat $fifo | cat $fifo &
pid=$!
exec 60</proc/$pid/fd/0
exec 61>/proc/$pid/fd/0
echo -n > $fifo
unlink $fifo
(
# run busybox (not detached)
runc run test_busybox
[ "$status" -eq 0 ]
) &
# check state
wait_for_container 15 1 test_busybox
runc state test_busybox
[ "$status" -eq 0 ]
[[ "${output}" == *"running"* ]]
__runc run -d test_busybox <&60 >&51 2>&51
[ $? -eq 0 ]
testcontainer test_busybox running
#test checkpoint pre-dump
mkdir parent-dir
@ -95,7 +107,9 @@ function teardown() {
# checkpoint the running container
mkdir image-dir
runc --criu "$CRIU" checkpoint --parent-path ./parent-dir --image-path ./image-dir test_busybox
mkdir work-dir
runc --criu "$CRIU" checkpoint --parent-path ./parent-dir --work-path ./work-dir --image-path ./image-dir test_busybox
cat ./work-dir/dump.log | grep -B 5 Error || true
[ "$status" -eq 0 ]
# after checkpoint busybox is no longer running
@ -103,16 +117,22 @@ function teardown() {
[ "$status" -ne 0 ]
# restore from checkpoint
(
runc --criu "$CRIU" restore --image-path ./image-dir test_busybox
[ "$status" -eq 0 ]
) &
# check state
wait_for_container 15 1 test_busybox
__runc --criu "$CRIU" restore -d --work-path ./work-dir --image-path ./image-dir test_busybox <&60 >&51 2>&51
ret=$?
cat ./work-dir/restore.log | grep -B 5 Error || true
[ $ret -eq 0 ]
# busybox should be back up and running
runc state test_busybox
testcontainer test_busybox running
runc exec --cwd /bin test_busybox echo ok
[ "$status" -eq 0 ]
[[ "${output}" == *"running"* ]]
[[ ${output} == "ok" ]]
echo Ping >&61
exec 61>&-
exec 51>&-
run cat <&50
[ "$status" -eq 0 ]
[[ "${output}" == *"ponG Ping"* ]]
}

View File

@ -17,8 +17,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
runc kill test_busybox KILL
@ -40,8 +38,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
# force delete test_busybox

View File

@ -19,9 +19,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
# generate stats
runc events --stats test_busybox
[ "$status" -eq 0 ]
@ -37,9 +34,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
# spawn two sub processes (shells)
# the first sub process is an event logger that sends stats events to events.log
# the second sub process waits for an event that incudes test_busybox then
@ -67,9 +61,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
# spawn two sub processes (shells)
# the first sub process is an event logger that sends stats events to events.log once a second
# the second sub process tries 3 times for an event that incudes test_busybox
@ -96,9 +87,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
#prove there is no carry over of events.log from a prior test
[ ! -e events.log ]

View File

@ -16,8 +16,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec test_busybox echo Hello from exec
[ "$status" -eq 0 ]
echo text echoed = "'""${output}""'"
@ -29,8 +27,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec --pid-file pid.txt test_busybox echo Hello from exec
[ "$status" -eq 0 ]
echo text echoed = "'""${output}""'"
@ -56,8 +52,6 @@ function teardown() {
runc run -d -b $BUSYBOX_BUNDLE --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec --pid-file pid.txt test_busybox echo Hello from exec
[ "$status" -eq 0 ]
echo text echoed = "'""${output}""'"
@ -77,8 +71,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec test_busybox ls -la
[ "$status" -eq 0 ]
[[ ${lines[0]} == *"total"* ]]
@ -91,8 +83,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec --cwd /bin test_busybox pwd
[ "$status" -eq 0 ]
[[ ${output} == "/bin" ]]
@ -103,8 +93,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec --env RUNC_EXEC_TEST=true test_busybox env
[ "$status" -eq 0 ]
@ -119,8 +107,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec --user 1000:1000 test_busybox id
[ "$status" -eq 0 ]

View File

@ -18,8 +18,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
runc kill test_busybox KILL

View File

@ -21,15 +21,12 @@ function teardown() {
# run a few busyboxes detached
ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_box1
[ "$status" -eq 0 ]
wait_for_container_inroot 15 1 test_box1 $HELLO_BUNDLE
ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_box2
[ "$status" -eq 0 ]
wait_for_container_inroot 15 1 test_box2 $HELLO_BUNDLE
ROOT=$HELLO_BUNDLE runc run -d --console-socket $CONSOLE_SOCKET test_box3
[ "$status" -eq 0 ]
wait_for_container_inroot 15 1 test_box3 $HELLO_BUNDLE
ROOT=$HELLO_BUNDLE runc list
[ "$status" -eq 0 ]

View File

@ -23,8 +23,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec test_busybox cat /testfile
[ "$status" -eq 0 ]
[[ "${output}" == "" ]]
@ -43,8 +41,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
runc exec test_busybox ls /testdir
[ "$status" -eq 0 ]
[[ "${output}" == "" ]]

View File

@ -19,7 +19,7 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
# pause busybox
runc pause test_busybox
@ -44,7 +44,7 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
# pause test_busybox and nonexistent container
runc pause test_busybox

View File

@ -20,8 +20,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
runc ps test_busybox
@ -39,8 +37,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
runc ps -f json test_busybox
@ -57,8 +53,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
runc ps test_busybox -e -x

View File

@ -22,10 +22,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state of the busyboxes are only in their respective root path
wait_for_container 15 1 test_busybox
wait_for_container_inroot 15 1 test_dotbox $HELLO_BUNDLE
runc state test_busybox
[ "$status" -eq 0 ]
[[ "${output}" == *"running"* ]]

View File

@ -17,8 +17,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
}
@ -36,8 +34,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
}
@ -47,8 +43,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
# check pid.txt was generated
@ -71,8 +65,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
# check pid.txt was generated

View File

@ -20,8 +20,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
runc kill test_busybox KILL
@ -50,8 +48,6 @@ function teardown() {
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
testcontainer test_busybox running
# pause busybox

View File

@ -64,9 +64,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
# make sure we're running
testcontainer test_busybox running
@ -87,9 +84,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
# make sure we're running
testcontainer test_busybox running
@ -113,9 +107,6 @@ function teardown() {
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
# make sure we're running
testcontainer test_busybox running

View File

@ -61,7 +61,6 @@ function check_cgroup_value() {
# run a few busyboxes detached
runc run -d --console-socket $CONSOLE_SOCKET test_update
[ "$status" -eq 0 ]
wait_for_container 15 1 test_update
# get the cgroup paths
for g in MEMORY CPUSET CPU BLKIO PIDS; do
@ -266,7 +265,6 @@ EOF
# run a detached busybox
runc run -d --console-socket $CONSOLE_SOCKET test_update_rt
[ "$status" -eq 0 ]
wait_for_container 15 1 test_update_rt
# get the cgroup paths
eval CGROUP_CPU="${CGROUP_CPU_BASE_PATH}/runc-update-integration-test"