Files
runc/tests/integration/debug.bats
T
Kir Kolyshkin a5c14847f4 tests/int: remove useless/obvious comments
This is a bit opinionated, but some comments in integration tests do not
really help to understand the nature of the tests being performed by
stating something very obvious, like

	# run busybox detached
	runc run -d busybox

To make things worse, these not-so-helpful messages are being
copy/pasted over and over, and that is the main reason to remove them.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 0eb03ef86f)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-04-10 14:42:11 -07:00

70 lines
1.6 KiB
Bash

#!/usr/bin/env bats
load helpers
function setup() {
setup_busybox
update_config '.process.args = ["/bin/echo", "Hello World"]'
}
function teardown() {
teardown_bundle
}
function check_debug() {
[[ "$*" == *"nsexec container setup"* ]]
[[ "$*" == *"child process in init()"* ]]
[[ "$*" == *"init: closing the pipe to signal completion"* ]]
}
@test "global --debug" {
runc --debug run test_hello
[ "$status" -eq 0 ]
# check expected debug output was sent to stderr
[[ "${output}" == *"level=debug"* ]]
check_debug "$output"
}
@test "global --debug to --log" {
runc --log log.out --debug run test_hello
[ "$status" -eq 0 ]
# check output does not include debug info
[[ "${output}" != *"level=debug"* ]]
cat log.out >&2
# check expected debug output was sent to log.out
output=$(cat log.out)
[[ "${output}" == *"level=debug"* ]]
check_debug "$output"
}
@test "global --debug to --log --log-format 'text'" {
runc --log log.out --log-format "text" --debug run test_hello
[ "$status" -eq 0 ]
# check output does not include debug info
[[ "${output}" != *"level=debug"* ]]
cat log.out >&2
# check expected debug output was sent to log.out
output=$(cat log.out)
[[ "${output}" == *"level=debug"* ]]
check_debug "$output"
}
@test "global --debug to --log --log-format 'json'" {
runc --log log.out --log-format "json" --debug run test_hello
[ "$status" -eq 0 ]
# check output does not include debug info
[[ "${output}" != *"level=debug"* ]]
cat log.out >&2
# check expected debug output was sent to log.out
output=$(cat log.out)
[[ "${output}" == *'"level":"debug"'* ]]
check_debug "$output"
}