Skip to content

Commit

Permalink
test access stdio in userns container
Browse files Browse the repository at this point in the history
Signed-off-by: lifubang <[email protected]>
  • Loading branch information
lifubang committed Oct 27, 2024
1 parent 02ad8b3 commit 7b9586a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/integration/userns.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@ function teardown() {
fi
}

@test "runc check stdio permission in userns [terminal=false]" {
update_config ' .process.terminal = false
| .process.args = ["sh", "-c", "echo errormsg > /dev/stderr"]'

touch log
__runc create test_busybox >log 2>&1

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

wait_for_container 10 1 test_busybox stopped

out=$(cat log)
# Keep this to debug is useful once we have a regression about this.
echo "$out" >&2

# We should let stdio could be accessed in user ns container.
# Please see https://github.com/opencontainers/runc/issues/4475
[[ "$out" = "errormsg" ]]
}

@test "userns with simple mount" {
update_config ' .process.args += ["-c", "stat /tmp/mount-1/foo.txt"]
| .mounts += [{"source": "source-accessible/dir", "destination": "/tmp/mount-1", "options": ["bind"]}] '
Expand Down

0 comments on commit 7b9586a

Please sign in to comment.