2
2
3
3
load helpers
4
4
5
- function setup() {
6
- setup_busybox
7
- }
8
-
9
5
function teardown() {
10
6
teardown_bundle
11
7
}
12
8
13
9
@test " runc run [redundant default /dev/tty]" {
10
+ setup_busybox
11
+
14
12
update_config ' .linux.devices += [{"path": "/dev/tty", "type": "c", "major": 5, "minor": 0}]
15
13
| .process.args |= ["ls", "-lLn", "/dev/tty"]'
16
14
@@ -25,6 +23,8 @@ function teardown() {
25
23
}
26
24
27
25
@test " runc run [redundant default /dev/ptmx]" {
26
+ setup_busybox
27
+
28
28
update_config ' .linux.devices += [{"path": "/dev/ptmx", "type": "c", "major": 5, "minor": 2}]
29
29
| .process.args |= ["ls", "-lLn", "/dev/ptmx"]'
30
30
@@ -36,6 +36,8 @@ function teardown() {
36
36
@test " runc run/update [device cgroup deny]" {
37
37
requires root
38
38
39
+ setup_busybox
40
+
39
41
update_config ' .linux.resources.devices = [{"allow": false, "access": "rwm"}]
40
42
| .linux.devices = [{"path": "/dev/kmsg", "type": "c", "major": 1, "minor": 11}]
41
43
| .process.capabilities.bounding += ["CAP_SYSLOG"]
@@ -73,6 +75,8 @@ function teardown() {
73
75
@test " runc run [device cgroup allow rw char device]" {
74
76
requires root
75
77
78
+ setup_busybox
79
+
76
80
update_config ' .linux.resources.devices = [{"allow": false, "access": "rwm"},{"allow": true, "type": "c", "major": 1, "minor": 11, "access": "rw"}]
77
81
| .linux.devices = [{"path": "/dev/kmsg", "type": "c", "major": 1, "minor": 11}]
78
82
| .process.args |= ["sh"]
@@ -104,6 +108,8 @@ function teardown() {
104
108
@test " runc run [device cgroup allow rm block device]" {
105
109
requires root
106
110
111
+ setup_busybox
112
+
107
113
# Get the first block device.
108
114
IFS=$' \t :' read -r device major minor <<< " $(lsblk -nd -o NAME,MAJ:MIN)"
109
115
# Could have used -o PATH but lsblk from CentOS 7 does not have it.
@@ -133,6 +139,8 @@ function teardown() {
133
139
@test " runc exec vs systemctl daemon-reload" {
134
140
requires systemd root
135
141
142
+ setup_busybox
143
+
136
144
runc run -d --console-socket " $CONSOLE_SOCKET " test_exec
137
145
[ " $status " -eq 0 ]
138
146
@@ -144,3 +152,26 @@ function teardown() {
144
152
runc exec -t test_exec sh -c " ls -l /proc/self/fd/0; echo 123"
145
153
[ " $status " -eq 0 ]
146
154
}
155
+
156
+ @test " runc run [hostname domainname]" {
157
+ requires root
158
+
159
+ setup_debian
160
+
161
+ update_config ' .process.args |= ["sh"]
162
+ | .hostname = "myhostname"
163
+ | .domainname= "mydomainname"'
164
+
165
+ runc run -d --console-socket " $CONSOLE_SOCKET " test_allow_char
166
+ [ " $status " -eq 0 ]
167
+
168
+ # test hostname
169
+ runc exec test_allow_char sh -c ' hostname'
170
+ [ " $status " -eq 0 ]
171
+ [[ " ${lines[0]} " == * ' myhostname' * ]]
172
+
173
+ # test domainname
174
+ runc exec test_allow_char sh -c ' domainname'
175
+ [ " $status " -eq 0 ]
176
+ [[ " ${lines[0]} " == * ' mydomainname' * ]]
177
+ }
0 commit comments