Skip to content

Commit cb07873

Browse files
committed
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>
1 parent b67f424 commit cb07873

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

tests/integration/checkpoint.bats

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ function teardown() {
1717

1818
# criu does not work with external terminals so..
1919
# setting terminal and root:readonly: to false
20-
sed -i 's;"terminal": true;"terminal": false;' config.json
21-
sed -i 's;"readonly": true;"readonly": false;' config.json
22-
sed -i 's/"sh"/"sh","-c","while :; do date; sleep 1; done"/' config.json
2320

24-
(
25-
# run busybox (not detached)
26-
runc run test_busybox
27-
[ "$status" -eq 0 ]
28-
) &
21+
runc run -d --console-socket $CONSOLE_SOCKET test_busybox
22+
[ "$status" -eq 0 ]
2923

3024
# check state
3125
wait_for_container 15 1 test_busybox
@@ -34,24 +28,26 @@ function teardown() {
3428
[ "$status" -eq 0 ]
3529
[[ "${output}" == *"running"* ]]
3630

37-
# checkpoint the running container
38-
runc --criu "$CRIU" checkpoint test_busybox
39-
# if you are having problems getting criu to work uncomment the following dump:
40-
#cat /run/opencontainer/containers/test_busybox/criu.work/dump.log
41-
[ "$status" -eq 0 ]
31+
for i in `seq 2`; do
32+
# checkpoint the running container
33+
runc --criu "$CRIU" checkpoint test_busybox
34+
# if you are having problems getting criu to work uncomment the following dump:
35+
#cat /run/opencontainer/containers/test_busybox/criu.work/dump.log
36+
[ "$status" -eq 0 ]
4237

43-
# after checkpoint busybox is no longer running
44-
runc state test_busybox
45-
[ "$status" -ne 0 ]
38+
# after checkpoint busybox is no longer running
39+
runc state test_busybox
40+
[ "$status" -ne 0 ]
4641

47-
# restore from checkpoint
48-
(
49-
runc --criu "$CRIU" restore test_busybox
50-
[ "$status" -eq 0 ]
51-
) &
42+
# restore from checkpoint
43+
(
44+
runc --criu "$CRIU" restore -d --console-socket $CONSOLE_SOCKET test_busybox
45+
[ "$status" -eq 0 ]
46+
) &
5247

53-
# check state
54-
wait_for_container 15 1 test_busybox
48+
# check state
49+
wait_for_container 15 1 test_busybox
50+
done
5551

5652
# busybox should be back up and running
5753
runc state test_busybox
@@ -63,8 +59,6 @@ function teardown() {
6359
# XXX: currently criu require root containers.
6460
requires criu root
6561

66-
# criu does not work with external terminals so..
67-
# setting terminal and root:readonly: to false
6862
sed -i 's;"terminal": true;"terminal": false;' config.json
6963
sed -i 's;"readonly": true;"readonly": false;' config.json
7064
sed -i 's/"sh"/"sh","-c","while :; do date; sleep 1; done"/' config.json

0 commit comments

Comments
 (0)