Skip to content

Commit ffe5cdc

Browse files
committed
tests: add various !terminal tests
Previously we weren't testing that detached io works properly -- which will be quite important in the case for rootless containers. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent ff5075c commit ffe5cdc

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

tests/integration/config.json

Whitespace-only changes.

tests/integration/tty.bats

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,58 @@ EOF
173173
# test tty width and height against original process.json
174174
[[ ${lines[0]} =~ "rows 10; columns 110" ]]
175175
}
176+
177+
@test "runc create [terminal=false]" {
178+
# Disable terminal creation.
179+
sed -i 's|"terminal": true,|"terminal": false,|g' config.json
180+
# Replace sh script with sleep.
181+
sed -i 's|"sh"|"sleep", "1000s"|' config.json
182+
183+
# Make sure that the handling of detached IO is done properly. See #1354.
184+
__runc create test_busybox
185+
186+
# Start the command.
187+
runc start test_busybox
188+
[ "$status" -eq 0 ]
189+
190+
testcontainer test_busybox running
191+
192+
# Kill the container.
193+
runc kill test_busybox KILL
194+
[ "$status" -eq 0 ]
195+
}
196+
197+
@test "runc run [terminal=false]" {
198+
# Disable terminal creation.
199+
sed -i 's|"terminal": true,|"terminal": false,|g' config.json
200+
# Replace sh script with sleep.
201+
sed -i 's|"sh"|"sleep", "1000s"|' config.json
202+
203+
# Make sure that the handling of non-detached IO is done properly. See #1354.
204+
(
205+
__runc run test_busybox
206+
) &
207+
208+
wait_for_container 15 1 test_busybox
209+
testcontainer test_busybox running
210+
211+
# Kill the container.
212+
runc kill test_busybox KILL
213+
[ "$status" -eq 0 ]
214+
}
215+
216+
@test "runc run -d [terminal=false]" {
217+
# Disable terminal creation.
218+
sed -i 's|"terminal": true,|"terminal": false,|g' config.json
219+
# Replace sh script with sleep.
220+
sed -i 's|"sh"|"sleep", "1000s"|' config.json
221+
222+
# Make sure that the handling of detached IO is done properly. See #1354.
223+
__runc run -d test_busybox
224+
225+
testcontainer test_busybox running
226+
227+
# Kill the container.
228+
runc kill test_busybox KILL
229+
[ "$status" -eq 0 ]
230+
}

0 commit comments

Comments
 (0)