github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/tests/integration/state.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 "state (kill + delete)" {
    14  	runc state test_busybox
    15  	[ "$status" -ne 0 ]
    16  
    17  	# run busybox detached
    18  	runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
    19  	[ "$status" -eq 0 ]
    20  
    21  	# check state
    22  	testcontainer test_busybox running
    23  
    24  	runc kill test_busybox KILL
    25  	[ "$status" -eq 0 ]
    26  	wait_for_container 10 1 test_busybox stopped
    27  
    28  	# delete test_busybox
    29  	runc delete test_busybox
    30  	[ "$status" -eq 0 ]
    31  
    32  	runc state test_busybox
    33  	[ "$status" -ne 0 ]
    34  }
    35  
    36  @test "state (pause + resume)" {
    37  	# XXX: pause and resume require cgroups.
    38  	requires root
    39  
    40  	runc state test_busybox
    41  	[ "$status" -ne 0 ]
    42  
    43  	# run busybox detached
    44  	runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
    45  	[ "$status" -eq 0 ]
    46  
    47  	# check state
    48  	testcontainer test_busybox running
    49  
    50  	# pause busybox
    51  	runc pause test_busybox
    52  	[ "$status" -eq 0 ]
    53  
    54  	# test state of busybox is paused
    55  	testcontainer test_busybox paused
    56  
    57  	# resume busybox
    58  	runc resume test_busybox
    59  	[ "$status" -eq 0 ]
    60  
    61  	# test state of busybox is back to running
    62  	testcontainer test_busybox running
    63  }