test: check C/R for a container with an external terminal

We have two test cases with and without pre-dump. Terminals and
pre-dump features are orthogonal, so we can modify one of these test cases.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Andrei Vagin 2017-04-20 05:54:07 +03:00
parent 73258813d3
commit 459a17b838
1 changed files with 19 additions and 25 deletions

View File

@ -17,15 +17,9 @@ function teardown() {
# criu does not work with external terminals so..
# 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
(
# run busybox (not detached)
runc run test_busybox
[ "$status" -eq 0 ]
) &
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
# check state
wait_for_container 15 1 test_busybox
@ -34,24 +28,26 @@ function teardown() {
[ "$status" -eq 0 ]
[[ "${output}" == *"running"* ]]
# checkpoint the running container
runc --criu "$CRIU" checkpoint test_busybox
# if you are having problems getting criu to work uncomment the following dump:
#cat /run/opencontainer/containers/test_busybox/criu.work/dump.log
[ "$status" -eq 0 ]
for i in `seq 2`; do
# checkpoint the running container
runc --criu "$CRIU" checkpoint test_busybox
# if you are having problems getting criu to work uncomment the following dump:
#cat /run/opencontainer/containers/test_busybox/criu.work/dump.log
[ "$status" -eq 0 ]
# after checkpoint busybox is no longer running
runc state test_busybox
[ "$status" -ne 0 ]
# after checkpoint busybox is no longer running
runc state test_busybox
[ "$status" -ne 0 ]
# restore from checkpoint
(
runc --criu "$CRIU" restore test_busybox
[ "$status" -eq 0 ]
) &
# restore from checkpoint
(
runc --criu "$CRIU" restore -d --console-socket $CONSOLE_SOCKET test_busybox
[ "$status" -eq 0 ]
) &
# check state
wait_for_container 15 1 test_busybox
# check state
wait_for_container 15 1 test_busybox
done
# busybox should be back up and running
runc state test_busybox
@ -63,8 +59,6 @@ function teardown() {
# XXX: currently criu require root containers.
requires criu root
# criu does not work with external terminals so..
# 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