github.com/zhuohuang-hust/src-cbuild@v0.0.0-20230105071821-c7aab3e7c840/mergeCode/runc/tests/integration/state.bats (about) 1 #!/usr/bin/env bats 2 3 load helpers 4 5 function setup() { 6 teardown_busybox 7 setup_busybox 8 } 9 10 function teardown() { 11 teardown_busybox 12 } 13 14 @test "state" { 15 runc state test_busybox 16 [ "$status" -ne 0 ] 17 18 # run busybox detached 19 runc run -d --console /dev/pts/ptmx test_busybox 20 [ "$status" -eq 0 ] 21 22 # check state 23 wait_for_container 15 1 test_busybox 24 25 testcontainer test_busybox running 26 27 # pause busybox 28 runc pause test_busybox 29 [ "$status" -eq 0 ] 30 31 # test state of busybox is paused 32 testcontainer test_busybox paused 33 34 # resume busybox 35 runc resume test_busybox 36 [ "$status" -eq 0 ] 37 38 # test state of busybox is back to running 39 testcontainer test_busybox running 40 41 runc kill test_busybox KILL 42 # wait for busybox to be in the destroyed state 43 retry 10 1 eval "__runc state test_busybox | grep -q 'stopped'" 44 45 # delete test_busybox 46 runc delete test_busybox 47 48 runc state test_busybox 49 [ "$status" -ne 0 ] 50 }