mirror of
https://github.com/opencontainers/runc.git
synced 2026-02-06 03:45:41 +01:00
1. In case runc binary file name is not runc, the test fails like
below. The fix is to get the binary name from $RUNC.
✗ runc command -h
(in test file tests/integration/help.bats, line 27)
`[[ ${lines[1]} =~ runc\ checkpoint+ ]]' failed
runc-go1.25.0-main checkpoint -h (status=0):
NAME:
runc-go1.25.0-main checkpoint - checkpoint a running container
2. Simplify the test by adding a loop for all commands. While at it, add
a loop for -h --help as well.
3. Add missing commands (create, ps, features).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
63 lines
1.1 KiB
Bash
63 lines
1.1 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load helpers
|
|
|
|
function setup() {
|
|
# It does not make sense to repeat these trivial tests for non-root.
|
|
# Also, they fail due to $ROOT not being set and XDG_RUNTIME_DIR
|
|
# pointing to another user's directory after sudo rootless.
|
|
requires root
|
|
}
|
|
|
|
@test "runc -h" {
|
|
runc -h
|
|
[ "$status" -eq 0 ]
|
|
[[ ${lines[0]} =~ NAME:+ ]]
|
|
[[ ${lines[1]} =~ runc\ '-'\ Open\ Container\ Initiative\ runtime+ ]]
|
|
|
|
runc --help
|
|
[ "$status" -eq 0 ]
|
|
[[ ${lines[0]} =~ NAME:+ ]]
|
|
[[ ${lines[1]} =~ runc\ '-'\ Open\ Container\ Initiative\ runtime+ ]]
|
|
}
|
|
|
|
@test "runc command -h" {
|
|
local runc
|
|
# shellcheck disable=SC2153
|
|
runc="$(basename "$RUNC")"
|
|
local cmds=(
|
|
checkpoint
|
|
create
|
|
delete
|
|
events
|
|
exec
|
|
kill
|
|
list
|
|
pause
|
|
ps
|
|
restore
|
|
resume
|
|
run
|
|
spec
|
|
start
|
|
state
|
|
update
|
|
features
|
|
)
|
|
|
|
for cmd in "${cmds[@]}"; do
|
|
for arg in "-h" "--help"; do
|
|
runc "$cmd" "$arg"
|
|
[ "$status" -eq 0 ]
|
|
[[ ${lines[0]} =~ NAME:+ ]]
|
|
[[ ${lines[1]} =~ $runc\ $cmd+ ]]
|
|
done
|
|
done
|
|
}
|
|
|
|
@test "runc foo -h" {
|
|
runc foo -h
|
|
[ "$status" -ne 0 ]
|
|
[[ "${output}" == *"No help topic for 'foo'"* ]]
|
|
}
|