github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/tests/integration/root.bats (about)

     1  #!/usr/bin/env bats
     2  
     3  load helpers
     4  
     5  function setup() {
     6  	setup_busybox
     7  	ALT_ROOT="$ROOT/alt"
     8  	mkdir -p "$ALT_ROOT/state"
     9  }
    10  
    11  function teardown() {
    12  	ROOT=$ALT_ROOT __runc delete -f test_dotbox
    13  	unset ALT_ROOT
    14  	teardown_bundle
    15  }
    16  
    17  @test "global --root" {
    18  	# run busybox detached using $ALT_ROOT for state
    19  	ROOT=$ALT_ROOT runc run -d --console-socket "$CONSOLE_SOCKET" test_dotbox
    20  	[ "$status" -eq 0 ]
    21  
    22  	# run busybox detached in default root
    23  	runc run -d --console-socket "$CONSOLE_SOCKET" test_busybox
    24  	[ "$status" -eq 0 ]
    25  
    26  	runc state test_busybox
    27  	[ "$status" -eq 0 ]
    28  	[[ "${output}" == *"running"* ]]
    29  
    30  	ROOT=$ALT_ROOT runc state test_dotbox
    31  	[ "$status" -eq 0 ]
    32  	[[ "${output}" == *"running"* ]]
    33  
    34  	ROOT=$ALT_ROOT runc state test_busybox
    35  	[ "$status" -ne 0 ]
    36  
    37  	runc state test_dotbox
    38  	[ "$status" -ne 0 ]
    39  
    40  	runc kill test_busybox KILL
    41  	[ "$status" -eq 0 ]
    42  	wait_for_container 10 1 test_busybox stopped
    43  	runc delete test_busybox
    44  	[ "$status" -eq 0 ]
    45  
    46  	ROOT=$ALT_ROOT runc kill test_dotbox KILL
    47  	[ "$status" -eq 0 ]
    48  	ROOT=$ALT_ROOT wait_for_container 10 1 test_dotbox stopped
    49  	ROOT=$ALT_ROOT runc delete test_dotbox
    50  	[ "$status" -eq 0 ]
    51  }