Skip to content

Commit

Permalink
add a testcase for runc delete the container with host pid ns
Browse files Browse the repository at this point in the history
Signed-off-by: lifubang <lifubang@acmcoder.com>
  • Loading branch information
lifubang committed Nov 6, 2023
1 parent 48ff07c commit cc9addd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/integration/delete.bats
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,27 @@ EOF
# Expect "no such unit" exit code.
run -4 systemctl status $user "$SD_UNIT_NAME"
}

@test "runc delete [with host pid namespace]" {
update_config ' .linux.namespaces -= [{"type": "pid"}]
| .process.terminal = false
| .process.args |= ["/bin/sleep", "1d"]'

__runc run -d test_host_pidns

This comment has been minimized.

Copy link
@kolyshkin

kolyshkin Nov 6, 2023

Contributor

This should be runc not __runc, otherwise the next like does not make sense (since __runc does not set $status.

[ "$status" -eq 0 ]
testcontainer test_host_pidns running

runc state test_host_pidns
pid=$(echo $output | jq .pid)

__runc exec -d test_host_pidns sleep 2d
[ "$status" -eq 0 ]
testcontainer test_host_pidns running

kill -9 $pid
[ "$status" -eq 0 ]
testcontainer test_host_pidns stopped

runc delete test_host_pidns
[ "$status" -eq 0 ]
}

0 comments on commit cc9addd

Please sign in to comment.