Files
Kir Kolyshkin 4b214aef2f tests/int: check runc exit codes
A fair number of runc calls do not check the exit code at all, although
they should. Fix that.

Note that two of the checks added to update.bats expect an error (exit
code 1), as the test cases there are about runc rejecting a combination
of options.

The remaining calls that do not check the exit code are the ones that
check $status themselves (in an if, or against different values), the
one in a background subshell (where a failure can not be detected), and
the one that is explicitly documented as being allowed to fail.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-10-02 14:47:43 -07:00

58 lines
1.0 KiB
Bash

#!/usr/bin/env bats
load helpers
function setup() {
setup_busybox
}
function teardown() {
teardown_bundle
}
@test "runc pause and resume" {
requires cgroups_freezer
if [ $EUID -ne 0 ]; then
requires rootless_cgroup
set_cgroups_path
fi
run -0 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
testcontainer test_busybox running
run -0 runc pause test_busybox
testcontainer test_busybox paused
run -0 runc resume test_busybox
testcontainer test_busybox running
}
@test "runc pause and resume with nonexist container" {
requires cgroups_freezer
if [ $EUID -ne 0 ]; then
requires rootless_cgroup
set_cgroups_path
fi
run -0 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
testcontainer test_busybox running
run -0 runc pause test_busybox
run ! runc pause nonexistent
testcontainer test_busybox paused
run -0 runc resume test_busybox
run ! runc resume nonexistent
testcontainer test_busybox running
run -0 runc delete --force test_busybox
run ! runc state test_busybox
}