forked from adamlaska/runc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmounts.bats
More file actions
65 lines (55 loc) · 1.53 KB
/
mounts.bats
File metadata and controls
65 lines (55 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bats
load helpers
function setup() {
setup_busybox
}
function teardown() {
teardown_bundle
}
@test "runc run [bind mount]" {
update_config ' .mounts += [{
source: ".",
destination: "/tmp/bind",
options: ["bind"]
}]
| .process.args |= ["ls", "/tmp/bind/config.json"]'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "${lines[0]}" == *'/tmp/bind/config.json'* ]]
}
# https://github.com/opencontainers/runc/issues/2246
@test "runc run [ro tmpfs mount]" {
update_config ' .mounts += [{
source: "tmpfs",
destination: "/mnt",
type: "tmpfs",
options: ["ro", "nodev", "nosuid", "mode=755"]
}]
| .process.args |= ["grep", "^tmpfs /mnt", "/proc/mounts"]'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "${lines[0]}" == *'ro,'* ]]
}
# https://github.com/opencontainers/runc/issues/3248
@test "runc run [ro /dev mount]" {
update_config ' .mounts |= map((select(.destination == "/dev") | .options += ["ro"]) // .)
| .process.args |= ["grep", "^tmpfs /dev", "/proc/mounts"]'
runc run test_busybox
[ "$status" -eq 0 ]
[[ "${lines[0]}" == *'ro,'* ]]
}
# https://github.com/opencontainers/runc/issues/2683
@test "runc run [tmpfs mount with absolute symlink]" {
# in container, /conf -> /real/conf
mkdir -p rootfs/real/conf
ln -s /real/conf rootfs/conf
update_config ' .mounts += [{
type: "tmpfs",
source: "tmpfs",
destination: "/conf/stack",
options: ["ro", "nodev", "nosuid"]
}]
| .process.args |= ["true"]'
runc run test_busybox
[ "$status" -eq 0 ]
}