mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
test: add case for GH #2086
Commit 5e0e67d7 ("fix permission denied") modified some code but
did not provide a test case.
This is a test case that was tested to fail before and succeed after
the above commit.
For more details, see https://github.com/opencontainers/runc/pull/2086
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load helpers
|
||||
|
||||
function setup() {
|
||||
teardown_busybox
|
||||
setup_busybox
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
teardown_busybox
|
||||
}
|
||||
|
||||
# Test case for https://github.com/opencontainers/runc/pull/2086
|
||||
@test "runc exec --user with no access to cwd" {
|
||||
requires root
|
||||
|
||||
chown 42 rootfs/root
|
||||
chmod 700 rootfs/root
|
||||
|
||||
update_config ' .process.cwd = "/root"
|
||||
| .process.user.uid = 42
|
||||
| .process.args |= ["sleep", "1h"]'
|
||||
|
||||
runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
runc exec --user 0 test_busybox true
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
Reference in New Issue
Block a user