Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/int: add hooks argv[0] test #4593

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/integration/hooks.bats
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,20 @@ function teardown() {
runc run ct1
[ "$status" -eq 0 ]
}

# https://github.com/opencontainers/runc/issues/1663
@test "runc run [hook's argv is preserved]" {
# Check that argv[0] and argv[1] passed to the hook's binary
# exactly as set in config.json.
update_config '.hooks |= {"startContainer": [{"path": "/bin/busybox", "args": ["cat", "/nosuchfile"]}]}'
runc run ct1
[ "$status" -ne 0 ]
[[ "$output" == *"cat: can't open"*"/nosuchfile"* ]]

# Busybox also accepts commands where argv[0] is "busybox",
# and argv[1] is applet name. Test this as well.
update_config '.hooks |= {"startContainer": [{"path": "/bin/busybox", "args": ["busybox", "cat", "/nosuchfile"]}]}'
runc run ct1
[ "$status" -ne 0 ]
[[ "$output" == *"cat: can't open"*"/nosuchfile"* ]]
}
Loading