diff --git a/tests/integration/checkpoint.bats b/tests/integration/checkpoint.bats index 4c5c6a038..0e9484068 100644 --- a/tests/integration/checkpoint.bats +++ b/tests/integration/checkpoint.bats @@ -33,8 +33,7 @@ function teardown() { [ "$status" -eq 0 ] # after checkpoint busybox is no longer running - runc state test_busybox - [ "$status" -ne 0 ] + testcontainer test_busybox checkpointed # restore from checkpoint runc --criu "$CRIU" restore -d --work-path ./work-dir --console-socket $CONSOLE_SOCKET test_busybox @@ -87,9 +86,7 @@ function teardown() { [ "$status" -eq 0 ] # busybox should still be running - runc state test_busybox - [ "$status" -eq 0 ] - [[ "${output}" == *"running"* ]] + testcontainer test_busybox running # checkpoint the running container mkdir image-dir @@ -99,8 +96,7 @@ function teardown() { [ "$status" -eq 0 ] # after checkpoint busybox is no longer running - runc state test_busybox - [ "$status" -ne 0 ] + testcontainer test_busybox checkpointed # restore from checkpoint __runc --criu "$CRIU" restore -d --work-path ./work-dir --image-path ./image-dir test_busybox <&60 >&51 2>&51 @@ -271,8 +267,7 @@ function teardown() { [ "$status" -eq 0 ] # after checkpoint busybox is no longer running - runc state test_busybox - [ "$status" -ne 0 ] + testcontainer test_busybox checkpointed # restore from checkpoint; this should restore the container into the existing network namespace runc --criu "$CRIU" restore -d --work-path ./work-dir --console-socket $CONSOLE_SOCKET test_busybox @@ -327,8 +322,7 @@ function teardown() { test -f ./work-dir/$tmplog2 # after checkpoint busybox is no longer running - runc state test_busybox - [ "$status" -ne 0 ] + testcontainer test_busybox checkpointed test -f ./work-dir/$tmplog2 && unlink ./work-dir/$tmplog2 # restore from checkpoint diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index de8be4ba5..df0795782 100644 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -310,6 +310,10 @@ function wait_for_container_inroot() { function testcontainer() { # test state of container runc state $1 + if [ $2 == "checkpointed" ]; then + [ "$status" -eq 1 ] + return + fi [ "$status" -eq 0 ] [[ "${output}" == *"$2"* ]] }