mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
bats: refactor run "$RUNC" -> runc
This makes it much simpler to write tests, and you don't have to worry about some of the oddness with bats. Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
@@ -19,33 +19,33 @@ function teardown() {
|
||||
|
||||
@test "list" {
|
||||
# start a few busyboxes detached
|
||||
run "$RUNC" --root $HELLO_BUNDLE start -d --console /dev/pts/ptmx test_box1
|
||||
ROOT=$HELLO_BUNDLE runc start -d --console /dev/pts/ptmx test_box1
|
||||
[ "$status" -eq 0 ]
|
||||
wait_for_container_inroot 15 1 test_box1 $HELLO_BUNDLE
|
||||
|
||||
run "$RUNC" --root $HELLO_BUNDLE start -d --console /dev/pts/ptmx test_box2
|
||||
ROOT=$HELLO_BUNDLE runc start -d --console /dev/pts/ptmx test_box2
|
||||
[ "$status" -eq 0 ]
|
||||
wait_for_container_inroot 15 1 test_box2 $HELLO_BUNDLE
|
||||
|
||||
run "$RUNC" --root $HELLO_BUNDLE start -d --console /dev/pts/ptmx test_box3
|
||||
ROOT=$HELLO_BUNDLE runc start -d --console /dev/pts/ptmx test_box3
|
||||
[ "$status" -eq 0 ]
|
||||
wait_for_container_inroot 15 1 test_box3 $HELLO_BUNDLE
|
||||
|
||||
run "$RUNC" --root $HELLO_BUNDLE list
|
||||
ROOT=$HELLO_BUNDLE runc list
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ${lines[0]} =~ ID\ +PID\ +STATUS\ +BUNDLE\ +CREATED+ ]]
|
||||
[[ "${lines[1]}" == *"test_box1"*[0-9]*"running"*$BUSYBOX_BUNDLE*[0-9]* ]]
|
||||
[[ "${lines[2]}" == *"test_box2"*[0-9]*"running"*$BUSYBOX_BUNDLE*[0-9]* ]]
|
||||
[[ "${lines[3]}" == *"test_box3"*[0-9]*"running"*$BUSYBOX_BUNDLE*[0-9]* ]]
|
||||
|
||||
run "$RUNC" --root $HELLO_BUNDLE list --format table
|
||||
ROOT=$HELLO_BUNDLE runc list --format table
|
||||
[ "$status" -eq 0 ]
|
||||
[[ ${lines[0]} =~ ID\ +PID\ +STATUS\ +BUNDLE\ +CREATED+ ]]
|
||||
[[ "${lines[1]}" == *"test_box1"*[0-9]*"running"*$BUSYBOX_BUNDLE*[0-9]* ]]
|
||||
[[ "${lines[2]}" == *"test_box2"*[0-9]*"running"*$BUSYBOX_BUNDLE*[0-9]* ]]
|
||||
[[ "${lines[3]}" == *"test_box3"*[0-9]*"running"*$BUSYBOX_BUNDLE*[0-9]* ]]
|
||||
|
||||
run "$RUNC" --root $HELLO_BUNDLE list --format json
|
||||
ROOT=$HELLO_BUNDLE runc list --format json
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${lines[0]}" == [\[][\{]"\"id\""[:]"\"test_box1\""[,]"\"pid\""[:]*[0-9][,]"\"status\""[:]*"\"running\""[,]"\"bundle\""[:]*$BUSYBOX_BUNDLE*[,]"\"created\""[:]*[0-9]*[\}]* ]]
|
||||
[[ "${lines[0]}" == *[,][\{]"\"id\""[:]"\"test_box2\""[,]"\"pid\""[:]*[0-9][,]"\"status\""[:]*"\"running\""[,]"\"bundle\""[:]*$BUSYBOX_BUNDLE*[,]"\"created\""[:]*[0-9]*[\}]* ]]
|
||||
|
||||
Reference in New Issue
Block a user