forked from opencontainers/runc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opencontainers#3996 from kolyshkin/double-hooks
Fix for host mount ns containers
- Loading branch information
Showing
2 changed files
with
33 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ] | ||
} |