github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/tests/integration/pause.bats (about) 1 #!/usr/bin/env bats 2 3 load helpers 4 5 function setup() { 6 setup_busybox 7 } 8 9 function teardown() { 10 teardown_bundle 11 } 12 13 @test "runc pause and resume" { 14 requires cgroups_freezer 15 if [ $EUID -ne 0 ]; then 16 requires rootless_cgroup 17 set_cgroups_path 18 fi 19 20 # run busybox detached 21 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox 22 [ "$status" -eq 0 ] 23 24 testcontainer test_busybox running 25 26 # pause busybox 27 runc pause test_busybox 28 [ "$status" -eq 0 ] 29 30 # test state of busybox is paused 31 testcontainer test_busybox paused 32 33 # resume busybox 34 runc resume test_busybox 35 [ "$status" -eq 0 ] 36 37 # test state of busybox is back to running 38 testcontainer test_busybox running 39 } 40 41 @test "runc pause and resume with nonexist container" { 42 requires cgroups_freezer 43 if [ $EUID -ne 0 ]; then 44 requires rootless_cgroup 45 set_cgroups_path 46 fi 47 48 # run test_busybox detached 49 runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox 50 [ "$status" -eq 0 ] 51 52 testcontainer test_busybox running 53 54 # pause test_busybox and nonexistent container 55 runc pause test_busybox 56 [ "$status" -eq 0 ] 57 runc pause nonexistent 58 [ "$status" -ne 0 ] 59 60 # test state of test_busybox is paused 61 testcontainer test_busybox paused 62 63 # resume test_busybox and nonexistent container 64 runc resume test_busybox 65 [ "$status" -eq 0 ] 66 runc resume nonexistent 67 [ "$status" -ne 0 ] 68 69 # test state of test_busybox is back to running 70 testcontainer test_busybox running 71 72 # delete test_busybox 73 runc delete --force test_busybox 74 75 runc state test_busybox 76 [ "$status" -ne 0 ] 77 }