Files
podman/test/kpod_run_ns.bats
Daniel J Walsh adf8809521 Add NetMode, UTSMode and IPCMode
Allow kpod create/run to create contianers in different network namespaces, uts namespaces and
IPC Namespaces.

This patch just handles the simple join the host, or another containers namespaces.

Lots more work needed to full integrate  --net

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

Closes: #64
Approved by: mheon
2017-12-02 15:32:56 +00:00

51 lines
1.1 KiB
Bash

#!/usr/bin/env bats
load helpers
function teardown() {
cleanup_test
}
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 ]
}
@test "run ipcns test" {
${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE}
tmp=$(mktemp /dev/shm/foo.XXXXX)
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --ipc=host ${ALPINE} ls $tmp
echo $output
out=$(echo $output | tr -d '\r')
[ "$status" -eq 0 ]
[ $out != $tmp ]
rm -f $tmp
run ${KPOD_BINARY} ${KPOD_OPTIONS} run --ipc=badpid ${ALPINE} sh -c 'echo $$'
echo $output
[ "$status" -ne 0 ]
}