Add support for pid ns

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #54
Approved by: umohnani8
This commit is contained in:
Daniel J Walsh
2017-11-22 11:00:50 -05:00
committed by Atomic Bot
parent 2a3934f1da
commit bd4e106de3
3 changed files with 66 additions and 4 deletions

28
test/kpod_run_ns.bats Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bats
load helpers
function setup() {
copy_images
}
@test "run pidns test" {
${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE}
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} sh -c 'echo \$\$'"
echo $output
[ "$status" -eq 0 ]
pid=$(echo $output | tr -d '\r')
[ $pid = "1" ]
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --pid=host ${ALPINE} sh -c 'echo \$\$'"
echo $output
pid=$(echo $output | tr -d '\r')
[ "$status" -eq 0 ]
[ $pid != "1" ]
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --pid=badpid ${ALPINE} sh -c 'echo $$'
echo $output
[ "$status" -ne 0 ]
}