mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
tests/int: add a test for host mntns vs hooks
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load helpers
|
||||
|
||||
function setup() {
|
||||
requires root
|
||||
setup_busybox
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
[ ! -v ROOT ] && return 0 # nothing to teardown
|
||||
|
||||
# XXX runc does not unmount a container which
|
||||
# shares mount namespace with the host.
|
||||
umount -R --lazy "$ROOT"/bundle/rootfs
|
||||
|
||||
teardown_bundle
|
||||
}
|
||||
|
||||
@test "runc run [host mount ns + hooks]" {
|
||||
update_config ' .process.args = ["/bin/echo", "Hello World"]
|
||||
| .hooks |= . + {"createRuntime": [{"path": "/bin/sh", "args": ["/bin/sh", "-c", "touch createRuntimeHook.$$"]}]}
|
||||
| .linux.namespaces -= [{"type": "mount"}]
|
||||
| .linux.maskedPaths = []
|
||||
| .linux.readonlyPaths = []'
|
||||
runc run test_host_mntns
|
||||
[ "$status" -eq 0 ]
|
||||
runc delete -f test_host_mntns
|
||||
|
||||
# There should be one such file.
|
||||
run -0 ls createRuntimeHook.*
|
||||
[ "$(echo "$output" | wc -w)" -eq 1 ]
|
||||
}
|
||||
Reference in New Issue
Block a user