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 <[email protected]>
  • Loading branch information
lifubang committed Nov 6, 2023
1 parent 48ff07c commit 9225eaa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/integration/delete.bats
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,29 @@ EOF
# Expect "no such unit" exit code.
run -4 systemctl status $user "$SD_UNIT_NAME"
}

@test "runc delete [with host pid namespace]" {
requires root

update_config ' .linux.namespaces -= [{"type": "pid"}]
| .process.terminal = false
| .process.args |= ["/bin/sleep", "1d"]'

__runc run -d test_host_pidns
[ "$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 9225eaa

Please sign in to comment.