2016-03-15 03:55:05 +08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
teardown_busybox
|
|
|
|
setup_busybox
|
|
|
|
}
|
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
teardown_busybox
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "runc start detached" {
|
|
|
|
# start busybox detached
|
2016-05-09 21:06:42 +08:00
|
|
|
runc start -d --console /dev/pts/ptmx test_busybox
|
2016-03-15 03:55:05 +08:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
# check state
|
|
|
|
wait_for_container 15 1 test_busybox
|
|
|
|
|
|
|
|
testcontainer test_busybox running
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "runc start detached --pid-file" {
|
|
|
|
# start busybox detached
|
2016-05-09 21:06:42 +08:00
|
|
|
runc start --pid-file pid.txt -d --console /dev/pts/ptmx test_busybox
|
2016-03-15 03:55:05 +08:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
|
|
|
# check state
|
|
|
|
wait_for_container 15 1 test_busybox
|
|
|
|
|
|
|
|
testcontainer test_busybox running
|
|
|
|
|
2016-05-16 16:21:52 +08:00
|
|
|
# check pid.txt was generated
|
2016-03-15 03:55:05 +08:00
|
|
|
[ -e pid.txt ]
|
|
|
|
|
|
|
|
run cat pid.txt
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ ${lines[0]} =~ [0-9]+ ]]
|
|
|
|
}
|