Files
Kir Kolyshkin 5ff8136ed9 tests/int: call runc via bats' run helper
Now that runc is a real binary (a wrapper script in PATH), tests can
call it the way any other command is called, using bats' run helper
directly:

	run -0 runc start ctr

instead of the old

	runc start ctr
	[ "$status" -eq 0 ]

where runc was a bash function hiding a call to run. The exit code check
is now part of the call: -N for an expected exit code, ! for "any
failure", and no argument where the exit code is checked later or not at
all.

This has to be done in one go: while the runc function exists, "run runc"
would call it, resulting in a nested run.

Other changes made necessary or possible by this:

  - The runc and sane_run functions are gone. The output of a failed
    command is now printed by bats itself, see the previous commit.

  - __runc (a raw runc call, not using run) is now simply runc.

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

46 lines
805 B
Bash

#!/usr/bin/env bats
load helpers
function setup() {
setup_busybox
}
function teardown() {
teardown_bundle
}
@test "state (kill + delete)" {
run ! runc state test_busybox
run -0 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
testcontainer test_busybox running
run -0 runc kill test_busybox KILL
wait_for_container 10 1 test_busybox stopped
run -0 runc delete test_busybox
run ! runc state test_busybox
}
@test "state (pause + resume)" {
# XXX: pause and resume require cgroups.
requires root
run ! runc state test_busybox
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
}