diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-12-15 16:58:36 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-12-18 16:46:05 +0000 |
commit | 5770dc2640c216525ab84031e3712fcc46b3b087 (patch) | |
tree | 8a1c5c4e4a6ce6a35a3767247623a62bfd698f77 /test | |
parent | de3468e120d489d046c08dad72ba2262e222ccb1 (diff) | |
download | podman-5770dc2640c216525ab84031e3712fcc46b3b087.tar.gz podman-5770dc2640c216525ab84031e3712fcc46b3b087.tar.bz2 podman-5770dc2640c216525ab84031e3712fcc46b3b087.zip |
Rename all references to kpod to podman
The decision is in, kpod is going to be named podman.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #145
Approved by: umohnani8
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers.bash | 8 | ||||
-rw-r--r-- | test/kpod_attach.bats | 33 | ||||
-rw-r--r-- | test/kpod_history.bats | 54 | ||||
-rw-r--r-- | test/kpod_images.bats | 52 | ||||
-rw-r--r-- | test/kpod_inspect.bats | 53 | ||||
-rw-r--r-- | test/kpod_kill.bats | 65 | ||||
-rw-r--r-- | test/kpod_load.bats | 82 | ||||
-rw-r--r-- | test/kpod_mount.bats | 39 | ||||
-rw-r--r-- | test/kpod_pause.bats | 111 | ||||
-rw-r--r-- | test/kpod_ps.bats | 191 | ||||
-rw-r--r-- | test/kpod_pull.bats | 136 | ||||
-rw-r--r-- | test/kpod_rm.bats | 72 | ||||
-rw-r--r-- | test/kpod_rmi.bats | 52 | ||||
-rw-r--r-- | test/kpod_run.bats | 138 | ||||
-rw-r--r-- | test/kpod_save.bats | 59 | ||||
-rw-r--r-- | test/kpod_start.bats | 51 | ||||
-rw-r--r-- | test/kpod_stats.bats | 61 | ||||
-rw-r--r-- | test/kpod_stop.bats | 50 | ||||
-rw-r--r-- | test/kpod_tag.bats | 50 | ||||
-rw-r--r-- | test/podman_attach.bats | 33 | ||||
-rw-r--r-- | test/podman_create.bats (renamed from test/kpod_create.bats) | 6 | ||||
-rw-r--r-- | test/podman_diff.bats (renamed from test/kpod_diff.bats) | 8 | ||||
-rw-r--r-- | test/podman_exec.bats (renamed from test/kpod_exec.bats) | 8 | ||||
-rw-r--r-- | test/podman_export.bats (renamed from test/kpod_export.bats) | 8 | ||||
-rw-r--r-- | test/podman_history.bats | 54 | ||||
-rw-r--r-- | test/podman_images.bats | 52 | ||||
-rw-r--r-- | test/podman_import.bats (renamed from test/kpod_import.bats) | 40 | ||||
-rw-r--r-- | test/podman_inspect.bats | 53 | ||||
-rw-r--r-- | test/podman_kill.bats | 65 | ||||
-rw-r--r-- | test/podman_load.bats | 82 | ||||
-rw-r--r-- | test/podman_logs.bats (renamed from test/kpod_logs.bats) | 18 | ||||
-rw-r--r-- | test/podman_mount.bats | 39 | ||||
-rw-r--r-- | test/podman_pause.bats | 111 | ||||
-rw-r--r-- | test/podman_ps.bats | 191 | ||||
-rw-r--r-- | test/podman_pull.bats | 136 | ||||
-rw-r--r-- | test/podman_push.bats (renamed from test/kpod_push.bats) | 46 | ||||
-rw-r--r-- | test/podman_rm.bats | 72 | ||||
-rw-r--r-- | test/podman_rmi.bats | 52 | ||||
-rw-r--r-- | test/podman_run.bats | 138 | ||||
-rw-r--r-- | test/podman_run_ns.bats (renamed from test/kpod_run_ns.bats) | 14 | ||||
-rw-r--r-- | test/podman_save.bats | 59 | ||||
-rw-r--r-- | test/podman_start.bats | 51 | ||||
-rw-r--r-- | test/podman_stats.bats | 61 | ||||
-rw-r--r-- | test/podman_stop.bats | 50 | ||||
-rw-r--r-- | test/podman_tag.bats | 50 | ||||
-rw-r--r-- | test/podman_top.bats (renamed from test/kpod_top.bats) | 16 | ||||
-rw-r--r-- | test/podman_version.bats (renamed from test/kpod_version.bats) | 4 | ||||
-rw-r--r-- | test/podman_wait.bats (renamed from test/kpod_wait.bats) | 10 |
48 files changed, 1442 insertions, 1442 deletions
diff --git a/test/helpers.bash b/test/helpers.bash index abf481c9a..30f66f283 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -17,7 +17,7 @@ else CRIO_ROOT=$(cd "$INTEGRATION_ROOT/.."; pwd -P) fi -KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/bin/kpod} +PODMAN_BINARY=${PODMAN_BINARY:-${CRIO_ROOT}/bin/podman} # Path of the conmon binary. CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/bin/conmon} # Path of the default seccomp profile. @@ -73,7 +73,7 @@ BB="docker.io/library/busybox:latest" ALPINE="docker.io/library/alpine:latest" FEDORA_MINIMAL="registry.fedoraproject.org/fedora-minimal:latest" -# kpod pull needs a configuration file for shortname pulls +# podman pull needs a configuration file for shortname pulls export REGISTRIES_CONFIG_PATH="$INTEGRATION_ROOT/registries.conf" # Setup default hooks dir @@ -109,7 +109,7 @@ LIBPOD_CNI_PLUGIN=${LIBPOD_CNI_PLUGIN:-/opt/cni/bin/} POD_CIDR="10.88.0.0/16" POD_CIDR_MASK="10.88.*.*" -KPOD_OPTIONS="--root $TESTDIR/crio $STORAGE_OPTIONS --runroot $TESTDIR/crio-run --runtime ${RUNTIME_BINARY} --conmon ${CONMON_BINARY} --cni-config-dir ${LIBPOD_CNI_CONFIG}" +PODMAN_OPTIONS="--root $TESTDIR/crio $STORAGE_OPTIONS --runroot $TESTDIR/crio-run --runtime ${RUNTIME_BINARY} --conmon ${CONMON_BINARY} --cni-config-dir ${LIBPOD_CNI_CONFIG}" cp "$CONMON_BINARY" "$TESTDIR/conmon" @@ -160,7 +160,7 @@ function wait_until_reachable() { } function cleanup_test() { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm --force --all" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm --force --all" echo "$output" rm -rf "$TESTDIR" } diff --git a/test/kpod_attach.bats b/test/kpod_attach.bats deleted file mode 100644 index fe2781f8d..000000000 --- a/test/kpod_attach.bats +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "attach to a bogus container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} attach foobar" - echo "$output" - [ "$status" -eq 1 ] -} - -@test "attach to non-running container" { - ${KPOD_BINARY} ${KPOD_OPTIONS} create --name foobar -d -i ${ALPINE} ls - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} attach foobar" - echo "$output" - [ "$status" -eq 1 ] -} - -@test "attach to multiple containers" { - ${KPOD_BINARY} ${KPOD_OPTIONS} run --name foobar1 -d -i ${ALPINE} /bin/sh - ${KPOD_BINARY} ${KPOD_OPTIONS} run --name foobar2 -d -i ${ALPINE} /bin/sh - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} attach foobar1 foobar2" - echo "$output" - [ "$status" -eq 1 ] -} diff --git a/test/kpod_history.bats b/test/kpod_history.bats deleted file mode 100644 index 466b977db..000000000 --- a/test/kpod_history.bats +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "kpod history default" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} history $ALPINE - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod history with Go template format" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} history --format "{{.ID}} {{.Created}}" $ALPINE - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod history human flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} history --human=false $ALPINE - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod history quiet flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} history -q $ALPINE - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod history no-trunc flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} history --no-trunc $ALPINE - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod history json flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} history --format json $ALPINE | python -m json.tool" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod history short options" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} history -qH $ALPINE - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_images.bats b/test/kpod_images.bats deleted file mode 100644 index ae55c0a37..000000000 --- a/test/kpod_images.bats +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -IMAGE="busybox" - -function setup() { - prepare_network_conf -} - -function teardown() { - cleanup_test -} - -@test "kpod images" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod images test valid json" { - ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} - run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json - echo "$output" | python -m json.tool - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod images check name json output" { - ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} - run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json - [ "$status" -eq 0 ] - name=$(echo $output | python -c 'import sys; import json; print(json.loads(sys.stdin.read())[0])["names"][0]') - [ "$name" == "docker.io/library/${IMAGE}:latest" ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod images short options" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} images -qn - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_inspect.bats b/test/kpod_inspect.bats deleted file mode 100644 index 7a63208e9..000000000 --- a/test/kpod_inspect.bats +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "kpod inspect image" { - run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect ${ALPINE} | python -m json.tool" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod inspect non-existent container" { - run ${KPOD_BINARY} $KPOD_OPTIONS inspect 14rcole/non-existent - echo "$output" - [ "$status" -ne 0 ] -} - -@test "kpod inspect with format" { - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect --format {{.ID}} ${ALPINE} - echo "$output" - [ "$status" -eq 0 ] - inspectOutput="$output" - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS images --no-trunc --quiet ${ALPINE} - echo "$output" - [ "$status" -eq 0 ] - [ "$output" = "$inspectOutput" ] - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod inspect specified type" { - run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect --type image ${ALPINE} | python -m json.tool" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod inspect container with size" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} create ${BB} ls" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect --size $ctr_id | python -m json.tool | grep SizeRootFs" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_kill.bats b/test/kpod_kill.bats deleted file mode 100644 index 2bd749239..000000000 --- a/test/kpod_kill.bats +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "kill a bogus container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} kill foobar" - echo "$output" - [ "$status" -ne 0 ] -} - -@test "kill a running container by id" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 9999" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} kill $ctr_id" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] -} - -@test "kill a running container by id with TERM" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 9999" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} kill -s TERM $ctr_id" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps --no-trunc" - [ "$status" -eq 0 ] -} - -@test "kill a running container by name" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} kill -s TERM test1" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps --no-trunc" - [ "$status" -eq 0 ] -} - -@test "kill a running container by id with a bogus signal" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 9999" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} kill -s foobar $ctr_id" - [ "$status" -eq 1 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps --no-trunc" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_load.bats b/test/kpod_load.bats deleted file mode 100644 index 59b4a4e50..000000000 --- a/test/kpod_load.bats +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function setup() { - prepare_network_conf - copy_images -} - -function teardown() { - cleanup_test -} -@test "kpod load input flag" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $ALPINE - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $ALPINE - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar - echo "$output" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod load oci-archive image" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $ALPINE - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar - echo "$output" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod load oci-archive image with signature-policy" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $ALPINE - [ "$status" -eq 0 ] - cp /etc/containers/policy.json /tmp - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar - echo "$output" - [ "$status" -eq 0 ] - rm -f /tmp/policy.json - rm -f alpine.tar -} - -@test "kpod load using quiet flag" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $ALPINE - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $ALPINE - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -q -i alpine.tar - echo "$output" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod load directory" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-dir -o alp-dir $ALPINE - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $ALPINE - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alp-dir - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alp-dir - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod load non-existent file" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar - echo "$output" - [ "$status" -ne 0 ] -} diff --git a/test/kpod_mount.bats b/test/kpod_mount.bats deleted file mode 100644 index 12c41c071..000000000 --- a/test/kpod_mount.bats +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -IMAGE="redis:alpine" - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "mount" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} mount --notruncate | grep $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} mount --format=json | python -m json.tool | grep $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_pause.bats b/test/kpod_pause.bats deleted file mode 100644 index 1a9bd7dda..000000000 --- a/test/kpod_pause.bats +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function setup() { - prepare_network_conf - copy_images -} - -function teardown() { - cleanup_test -} - -@test "pause a bogus container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pause foobar" - echo "$output" - [ "$status" -eq 1 ] -} - -@test "unpause a bogus container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unpause foobar" - echo "$output" - [ "$status" -eq 1 ] -} - -@test "pause a created container by id" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unpause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm -f $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "pause a running container by id" { - skip "Test needs to wait for --force to work for kpod rm" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unpause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm -f $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "unpause a running container" { - skip "Test needs to wait for --force to work for kpod rm" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unpause $ctr_id" - echo "$output" - [ "$status" -eq 1 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm -f $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "remove a paused container by id" { - skip "Test needs to wait for --force to work for kpod rm" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm $ctr_id" - echo "$output" - [ "$status" -eq 1 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm --force $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "stop a paused container created by id" { - skip "Test needs to wait for kpod stop to be implemented" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB sleep 60" - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id" - echo "$output" - [ "$status" -eq 1 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} unpause $ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id=$ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_ps.bats b/test/kpod_ps.bats deleted file mode 100644 index 3f4758f59..000000000 --- a/test/kpod_ps.bats +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -IMAGE="redis:alpine" -function setup() { - prepare_network_conf - copy_images -} - -function teardown() { - cleanup_test -} - -@test "kpod ps with no containers" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps default" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps all flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps size flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --size" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps quiet flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - ctr_id="$output" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --quiet" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps latest flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps --latest" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps last flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${BB} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls -s" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps --last 2" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps no-trunc flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --no-trunc" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps namespace flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps --all --namespace" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps namespace flag and format flag = json" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns --format json | python -m json.tool | grep namespace" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps without namespace flag and format flag = json" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --format json | python -m json.tool | grep namespace" - echo "$output" - [ "$status" -eq 1 ] -} - -@test "kpod ps format flag = go template" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --format 'table {{.ID}} {{.Image}} {{.Labels}}'" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps filter flag - ancestor" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter ancestor=${ALPINE}" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps filter flag - id" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id=$ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps filter flag - status" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 99" - ctr_id="$output" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter status=running" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps short options" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 99" - ctr_id="$output" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -aq" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod ps with mutually exclusive flags" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 99" - ctr_id="$output" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -aqs" - echo "$output" - [ "$status" -ne 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns -s" - echo "$output" - [ "$status" -ne 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns format {{.ID}}" - echo "$output" - [ "$status" -ne 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns --format json" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_pull.bats b/test/kpod_pull.bats deleted file mode 100644 index 6996f59cf..000000000 --- a/test/kpod_pull.bats +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -@test "kpod pull from docker with tag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10 - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10 - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull from docker without tag" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull debian - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull from a non-docker registry with tag" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora:rawhide - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull from a non-docker registry without tag" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull using digest" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull from a non existent image" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull umohnani/get-started - echo "$output" - [ "$status" -ne 0 ] -} - -@test "kpod pull from docker with shortname" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull from docker with shortname and tag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10 - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10 - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod pull from docker-archive" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alp.tar alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker-archive:alp.tar - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine - echo "$output" - [ "$status" -eq 0 ] - rm -f alp.tar -} - -@test "kpod pull from oci-archive" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-archive -o oci-alp.tar alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull oci-archive:oci-alp.tar - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine - echo "$output" - [ "$status" -eq 0 ] - rm -f oci-alp.tar -} - -@test "kpod pull from local directory" { - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine - echo "$output" - [ "$status" -eq 0 ] - run mkdir test_pull_dir - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} push alpine dir:test_pull_dir - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull dir:test_pull_dir - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi test_pull_dir - echo "$output" - [ "$status" -eq 0 ] - rm -rf test_pull_dir -} diff --git a/test/kpod_rm.bats b/test/kpod_rm.bats deleted file mode 100644 index 02e184f4c..000000000 --- a/test/kpod_rm.bats +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function setup() { - prepare_network_conf - copy_images -} - -function teardown() { - cleanup_test -} - -@test "remove a stopped container" { - run ${KPOD_BINARY} $KPOD_OPTIONS run -d ${ALPINE} ls - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "refuse to remove a running container" { - run ${KPOD_BINARY} $KPOD_OPTIONS run -d ${ALPINE} sleep 15 - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id" - echo "$output" - [ "$status" -ne 0 ] -} - -@test "remove a created container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "remove a running container" { - run ${KPOD_BINARY} $KPOD_OPTIONS run -d ${ALPINE} sleep 15 - echo "$output" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "remove all containers" { - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls -l - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB true - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB whoami - run ${KPOD_BINARY} $KPOD_OPTIONS rm -a - echo "$output" - [ "$status" -eq 0 ] -} - -@test "remove all containers with one running with short options" { - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls -l - ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB whoami - ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 30 - run ${KPOD_BINARY} $KPOD_OPTIONS rm -af - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_rmi.bats b/test/kpod_rmi.bats deleted file mode 100644 index 034fd9ab7..000000000 --- a/test/kpod_rmi.bats +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -IMAGE1="docker.io/library/alpine:latest" -IMAGE2="docker.io/library/busybox:latest" -IMAGE3="docker.io/library/busybox:glibc" - -function teardown() { - cleanup_test -} - -function pullImages() { - ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE1 - ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE2 - ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE3 -} - -@test "kpod rmi bogus image" { - run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10 - echo "$output" - [ "$status" -eq 1 ] -} - -@test "kpod rmi image with fq name" { - pullImages - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE1 - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod rmi image with short name" { - pullImages - run ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod rmi all images" { - pullImages - run ${KPOD_BINARY} $KPOD_OPTIONS rmi -a - echo "$output" - [ "$status" -eq 0 ] -} - -@test "kpod rmi all images forceably with short options" { - pullImages - ${KPOD_BINARY} $KPOD_OPTIONS create ${IMAGE1} ls - run ${KPOD_BINARY} $KPOD_OPTIONS rmi -af - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_run.bats b/test/kpod_run.bats deleted file mode 100644 index f01d254cc..000000000 --- a/test/kpod_run.bats +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "run a container based on local image" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run $BB ls" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "run a container based on local image with short options" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -dt $BB ls" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "run a container based on a remote image" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${BB_GLIBC} ls" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "run selinux test" { - if [ ! -e /usr/sbin/selinuxenabled ] || [ ! /usr/sbin/selinuxenabled ]; then - skip "SELinux not enabled" - fi - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current" - echo "$output" - firstLabel=$output - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current" - echo "$output" - [ "$output" != "${firstLabel}" ] -} - - -@test "run selinux grep test" { - skip "Until console issues worked out" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -t -i --security-opt label=level:s0:c1,c2 ${ALPINE} cat /proc/self/attr/current | grep s0:c1,c2" - echo "$output" - [ "$status" -eq 0 ] - -} - -@test "run capabilities test" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status" - echo "$output" - [ "$status" -eq 0 ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status" - echo "$output" - [ "$status" -eq 0 ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status" - echo "$output" - [ "$status" -eq 0 ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status" - echo "$output" - [ "$status" -eq 0 ] - -} - -@test "run environment test" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'" - echo "$output" - [ "$status" -eq 0 ] - [ $output = "BAR" ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'" - echo "$output" - [ "$status" -eq 0 ] - [ $output = "/bin" ] - - run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO ${ALPINE} printenv FOO | tr -d '\r'" - echo "$output" - [ "$status" -eq 0 ] - [ "$output" = "BAR" ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --env FOO ${ALPINE} printenv" - echo "$output" - [ "$status" -ne 0 ] - -# We don't currently set the hostname in containers, since we are not setting up -# networking. As soon as kpod run gets network support we need to uncomment this -# test. -# run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} sh -c printenv | grep HOSTNAME" -# echo "$output" -# [ "$status" -eq 0 ] -} - -IMAGE="docker.io/library/fedora:latest" - -@test "run limits test" { - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE}" - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --ulimit rtprio=99 --cap-add=sys_nice ${IMAGE} cat /proc/self/sched" - echo $output - [ "$status" -eq 0 ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --ulimit nofile=2048:2048 ${IMAGE} ulimit -n | tr -d '\r'" - echo $output - [ "$status" -eq 0 ] - [ "$output" = 2048 ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --oom-kill-disable=true ${IMAGE} echo memory-hog" - echo $output - [ "$status" -eq 0 ] - - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --oom-score-adj=100 ${IMAGE} cat /proc/self/oom_score_adj | tr -d '\r'" - echo $output - [ "$status" -eq 0 ] - [ "$output" = 100 ] - -} - -@test "kpod run with volume flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime'" - echo $output - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:ro ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test ro,relatime'" - echo $output - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -v ${MOUNT_PATH}:/run/test:shared ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime shared:'" - echo $output - [ "$status" -eq 0 ] -} diff --git a/test/kpod_save.bats b/test/kpod_save.bats deleted file mode 100644 index 03d24ed86..000000000 --- a/test/kpod_save.bats +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "kpod save output flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $ALPINE" - echo "$output" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod save oci flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE" - echo "$output" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod save using stdout" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save $ALPINE > alpine.tar" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod save quiet flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save -q -o alpine.tar $ALPINE" - echo "$output" - [ "$status" -eq 0 ] - rm -f alpine.tar -} - -@test "kpod save non-existent image" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar FOOBAR" - echo "$output" - [ "$status" -ne 0 ] -} - -@test "kpod save to directory wit oci format" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-dir -o alp-dir $ALPINE" - echo "$output" - [ "$status" -eq 0 ] - rm -rf alp-dir -} - -@test "kpod save to directory wit v2s2 (docker) format" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} save --format docker-dir -o alp-dir $ALPINE" - echo "$output" - [ "$status" -eq 0 ] - rm -rf alp-dir -} diff --git a/test/kpod_start.bats b/test/kpod_start.bats deleted file mode 100644 index 999b29982..000000000 --- a/test/kpod_start.bats +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function setup() { - prepare_network_conf - copy_images -} - -function teardown() { - cleanup_test -} - -@test "start bogus container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} start 1234 - echo "$output" - [ "$status" -eq 1 ] -} - -@test "start single container by id" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create -d ${ALPINE} ls - ctr_id=${output} - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} start $ctr_id - echo "$output" - [ "$status" -eq 0 ] -} - -@test "start single container by name" { - ${KPOD_BINARY} ${KPOD_OPTIONS} create -d --name foobar99 ${ALPINE} ls - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} start foobar - echo "$output" - [ "$status" -eq 0 ] -} - -@test "start multiple containers" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create -d ${ALPINE} ls - ctr1_id=${output} - run ${KPOD_BINARY} ${KPOD_OPTIONS} create -d ${ALPINE} ls - ctr1_id2=${output} - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} start $ctr1_id $ctr2_id - echo "$output" - [ "$status" -eq 0 ] -} - -@test "start multiple containers -- attach should fail" { - ${KPOD_BINARY} ${KPOD_OPTIONS} create --name foobar1 -d ${ALPINE} ls - ${KPOD_BINARY} ${KPOD_OPTIONS} create --name foobar2 -d ${ALPINE} ls - run ${KPOD_BINARY} ${KPOD_OPTIONS} start -a foobar1 foobar2 - echo "$output" - [ "$status" -eq 1 ] -} diff --git a/test/kpod_stats.bats b/test/kpod_stats.bats deleted file mode 100644 index b4c879c46..000000000 --- a/test/kpod_stats.bats +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "stats should run with no containers" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream - echo "$output" - [ "$status" -eq 0 ] -} - -@test "stats with bogus container id" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream 123 - echo "$output" - [ "$status" -eq 1 ] -} - -@test "stats on a running container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} sleep 99 - ctr_id="$output" - echo "$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream $ctr_id" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "stats on a running container no id" { - ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} sleep 99 - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream - echo "$output" - [ "$status" -eq 0 ] -} - -@test "stats on all containers" { - ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} ls - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream -a - echo "$output" - [ "$status" -eq 0 ] -} - -@test "stats only output IDs" { - ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} sleep 99 - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format "{{.Container}}" - echo "$output" - [ "$status" -eq 0 ] -} - -@test "stats json output" { - ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t ${ALPINE} ls - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream -a --format json | python -m json.tool" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_stop.bats b/test/kpod_stop.bats deleted file mode 100644 index 0822d88f5..000000000 --- a/test/kpod_stop.bats +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -function teardown() { - cleanup_test -} - -function setup() { - prepare_network_conf - copy_images -} - -@test "stop a bogus container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop foobar" - echo "$output" - [ "$status" -eq 1 ] -} - -@test "stop a running container by id" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 9999" - [ "$status" -eq 0 ] - ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop $ctr_id" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] -} - -@test "stop a running container by name" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop test1" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} ps" - [ "$status" -eq 0 ] -} - -@test "stop all containers" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --name test2 -d ${ALPINE} sleep 9999" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --name test3 -d ${ALPINE} sleep 9999" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} stop -a -t 1" - echo "$output" - [ "$status" -eq 0 ] -} diff --git a/test/kpod_tag.bats b/test/kpod_tag.bats deleted file mode 100644 index ce3d19140..000000000 --- a/test/kpod_tag.bats +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bats - -load helpers - -IMAGE="alpine:latest" - -function teardown() { - cleanup_test -} - -@test "kpod tag with shortname:latest" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:latest" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest" - [ "$status" -eq 0 ] -} - -@test "kpod tag with shortname" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest" - [ "$status" -eq 0 ] -} - -@test "kpod tag with shortname:tag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:v" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:v" - echo "$output" - [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:v" - [ "$status" -eq 0 ] -} diff --git a/test/podman_attach.bats b/test/podman_attach.bats new file mode 100644 index 000000000..1d3451eeb --- /dev/null +++ b/test/podman_attach.bats @@ -0,0 +1,33 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "attach to a bogus container" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar" + echo "$output" + [ "$status" -eq 1 ] +} + +@test "attach to non-running container" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name foobar -d -i ${ALPINE} ls + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar" + echo "$output" + [ "$status" -eq 1 ] +} + +@test "attach to multiple containers" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar1 -d -i ${ALPINE} /bin/sh + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name foobar2 -d -i ${ALPINE} /bin/sh + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} attach foobar1 foobar2" + echo "$output" + [ "$status" -eq 1 ] +} diff --git a/test/kpod_create.bats b/test/podman_create.bats index e4903f6aa..a9f70cdfa 100644 --- a/test/kpod_create.bats +++ b/test/podman_create.bats @@ -12,19 +12,19 @@ function teardown() { } @test "create a container based on local image" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls echo "$output" [ "$status" -eq 0 ] } @test "create a container based on a remote image" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create ${BB_GLIBC} ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create ${BB_GLIBC} ls echo "$output" [ "$status" -eq 0 ] } @test "ensure short options" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create -dt ${BB_GLIBC} ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -dt ${BB_GLIBC} ls echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_diff.bats b/test/podman_diff.bats index 5b71dfd48..942af8805 100644 --- a/test/kpod_diff.bats +++ b/test/podman_diff.bats @@ -12,20 +12,20 @@ function teardown() { } @test "test diff of image and parent" { - run ${KPOD_BINARY} $KPOD_OPTIONS diff $BB + run ${PODMAN_BINARY} $PODMAN_OPTIONS diff $BB echo "$output" [ "$status" -eq 0 ] } @test "test diff on non-existent layer" { - run ${KPOD_BINARY} $KPOD_OPTIONS diff "abc123" + run ${PODMAN_BINARY} $PODMAN_OPTIONS diff "abc123" echo "$output" [ "$status" -ne 0 ] } @test "test diff with json output" { - # run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} diff --format json $IMAGE | python -m json.tool" - run ${KPOD_BINARY} $KPOD_OPTIONS diff --format json $BB + # run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} diff --format json $IMAGE | python -m json.tool" + run ${PODMAN_BINARY} $PODMAN_OPTIONS diff --format json $BB echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_exec.bats b/test/podman_exec.bats index 5396298d3..57f7217d8 100644 --- a/test/kpod_exec.bats +++ b/test/podman_exec.bats @@ -12,20 +12,20 @@ function setup() { } @test "exec into a bogus container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} exec foobar ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar ls echo "$output" [ "$status" -eq 1 ] } @test "exec without command should fail" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} exec foobar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar echo "$output" [ "$status" -eq 1 ] } @test "exec simple command" { - ${KPOD_BINARY} ${KPOD_OPTIONS} run -d -t --name foobar1 ${ALPINE} sleep 60 - run ${KPOD_BINARY} ${KPOD_OPTIONS} exec foobar1 ls + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t --name foobar1 ${ALPINE} sleep 60 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} exec foobar1 ls echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_export.bats b/test/podman_export.bats index 59942ea57..2a620dc4a 100644 --- a/test/kpod_export.bats +++ b/test/podman_export.bats @@ -11,15 +11,15 @@ function setup() { copy_images } -@test "kpod export output flag" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} create $BB ls" +@test "podman export output flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" echo "$output" [ "$status" -eq 0 ] rm -f container.tar diff --git a/test/podman_history.bats b/test/podman_history.bats new file mode 100644 index 000000000..ea5aa8d31 --- /dev/null +++ b/test/podman_history.bats @@ -0,0 +1,54 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "podman history default" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} history $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman history with Go template format" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} history --format "{{.ID}} {{.Created}}" $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman history human flag" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} history --human=false $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman history quiet flag" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} history -q $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman history no-trunc flag" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} history --no-trunc $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman history json flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} history --format json $ALPINE | python -m json.tool" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman history short options" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} history -qH $ALPINE + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_images.bats b/test/podman_images.bats new file mode 100644 index 000000000..f62508e80 --- /dev/null +++ b/test/podman_images.bats @@ -0,0 +1,52 @@ +#!/usr/bin/env bats + +load helpers + +IMAGE="busybox" + +function setup() { + prepare_network_conf +} + +function teardown() { + cleanup_test +} + +@test "podman images" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${IMAGE} + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} images + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi ${IMAGE} + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman images test valid json" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${IMAGE} + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images --format json + echo "$output" | python -m json.tool + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi ${IMAGE} + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman images check name json output" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${IMAGE} + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images --format json + [ "$status" -eq 0 ] + name=$(echo $output | python -c 'import sys; import json; print(json.loads(sys.stdin.read())[0])["names"][0]') + [ "$name" == "docker.io/library/${IMAGE}:latest" ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi ${IMAGE} + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman images short options" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} images -qn + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/kpod_import.bats b/test/podman_import.bats index 7348a3c82..b665b789e 100644 --- a/test/kpod_import.bats +++ b/test/podman_import.bats @@ -13,8 +13,8 @@ function setup() { copy_images } -@test "kpod import with source and reference" { - skip "Test needs to be converted to kpod run bash -c" +@test "podman import with source and reference" { + skip "Test needs to be converted to podman run bash -c" start_crio run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -27,13 +27,13 @@ function setup() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar imported-image + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar imported-image echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} images echo "$output" [ "$status" -eq 0 ] images="$output" @@ -46,8 +46,8 @@ function setup() { rm -f container.tar } -@test "kpod import without reference" { - skip "Test needs to be converted to kpod run bash -c" +@test "podman import without reference" { + skip "Test needs to be converted to podman run bash -c" start_crio run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -60,13 +60,13 @@ function setup() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} images echo "$output" [ "$status" -eq 0 ] images="$output" @@ -79,8 +79,8 @@ function setup() { rm -f container.tar } -@test "kpod import with message flag" { - skip "Test needs to be converted to kpod run bash -c" +@test "podman import with message flag" { + skip "Test needs to be converted to podman run bash -c" start_crio run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -93,13 +93,13 @@ function setup() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import --message "importing container test message" container.tar imported-image + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import --message "importing container test message" container.tar imported-image echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history imported-image + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} history imported-image echo "$output" [ "$status" -eq 0 ] history="$output" @@ -112,8 +112,8 @@ function setup() { rm -f container.tar } -@test "kpod import with change flag" { - skip "Test needs to be converted to kpod run bash -c" +@test "podman import with change flag" { + skip "Test needs to be converted to podman run bash -c" start_crio run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" @@ -126,13 +126,13 @@ function setup() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image echo "$output" [ "$status" -eq 0 ] - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect imported-image + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect imported-image echo "$output" [ "$status" -eq 0 ] inspect="$output" diff --git a/test/podman_inspect.bats b/test/podman_inspect.bats new file mode 100644 index 000000000..197cc4556 --- /dev/null +++ b/test/podman_inspect.bats @@ -0,0 +1,53 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "podman inspect image" { + run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect ${ALPINE} | python -m json.tool" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman inspect non-existent container" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS inspect 14rcole/non-existent + echo "$output" + [ "$status" -ne 0 ] +} + +@test "podman inspect with format" { + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS inspect --format {{.ID}} ${ALPINE} + echo "$output" + [ "$status" -eq 0 ] + inspectOutput="$output" + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS images --no-trunc --quiet ${ALPINE} + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = "$inspectOutput" ] + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman inspect specified type" { + run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect --type image ${ALPINE} | python -m json.tool" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman inspect container with size" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create ${BB} ls" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS inspect --size $ctr_id | python -m json.tool | grep SizeRootFs" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_kill.bats b/test/podman_kill.bats new file mode 100644 index 000000000..88837aa8d --- /dev/null +++ b/test/podman_kill.bats @@ -0,0 +1,65 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "kill a bogus container" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill foobar" + echo "$output" + [ "$status" -ne 0 ] +} + +@test "kill a running container by id" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill $ctr_id" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] +} + +@test "kill a running container by id with TERM" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM $ctr_id" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc" + [ "$status" -eq 0 ] +} + +@test "kill a running container by name" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s TERM test1" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc" + [ "$status" -eq 0 ] +} + +@test "kill a running container by id with a bogus signal" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} kill -s foobar $ctr_id" + [ "$status" -eq 1 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --no-trunc" + [ "$status" -eq 0 ] +} diff --git a/test/podman_load.bats b/test/podman_load.bats new file mode 100644 index 000000000..1219144e4 --- /dev/null +++ b/test/podman_load.bats @@ -0,0 +1,82 @@ +#!/usr/bin/env bats + +load helpers + +function setup() { + prepare_network_conf + copy_images +} + +function teardown() { + cleanup_test +} +@test "podman load input flag" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar + echo "$output" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman load oci-archive image" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar + echo "$output" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman load oci-archive image with signature-policy" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE + [ "$status" -eq 0 ] + cp /etc/containers/policy.json /tmp + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar + echo "$output" + [ "$status" -eq 0 ] + rm -f /tmp/policy.json + rm -f alpine.tar +} + +@test "podman load using quiet flag" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -q -i alpine.tar + echo "$output" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman load directory" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi $ALPINE + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alp-dir + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alp-dir + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman load non-existent file" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} load -i alpine.tar + echo "$output" + [ "$status" -ne 0 ] +} diff --git a/test/kpod_logs.bats b/test/podman_logs.bats index 719dd6b06..927f36bca 100644 --- a/test/kpod_logs.bats +++ b/test/podman_logs.bats @@ -12,42 +12,42 @@ function setup() { } @test "display logs for container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB ls" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} logs $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} logs $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" echo "$output" [ "$status" -eq 0 ] } @test "tail three lines of logs for container" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB ls" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} logs --tail 3 $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --tail 3 $ctr_id" echo "$output" lines=$(echo "$output" | wc -l) [ "$status" -eq 0 ] [[ $(wc -l < "$output" ) -le 3 ]] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" echo "$output" [ "$status" -eq 0 ] } @test "display logs for container since a given time" { - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run -d $BB ls" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB ls" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} logs --since 2017-08-07T10:10:09.056611202-04:00 $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} logs --since 2017-08-07T10:10:09.056611202-04:00 $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} rm $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" echo "$output" [ "$status" -eq 0 ] } diff --git a/test/podman_mount.bats b/test/podman_mount.bats new file mode 100644 index 000000000..110cf0e93 --- /dev/null +++ b/test/podman_mount.bats @@ -0,0 +1,39 @@ +#!/usr/bin/env bats + +load helpers + +IMAGE="redis:alpine" + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "mount" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount --notruncate | grep $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unmount $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} mount --format=json | python -m json.tool | grep $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unmount $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_pause.bats b/test/podman_pause.bats new file mode 100644 index 000000000..1075fa05f --- /dev/null +++ b/test/podman_pause.bats @@ -0,0 +1,111 @@ +#!/usr/bin/env bats + +load helpers + +function setup() { + prepare_network_conf + copy_images +} + +function teardown() { + cleanup_test +} + +@test "pause a bogus container" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause foobar" + echo "$output" + [ "$status" -eq 1 ] +} + +@test "unpause a bogus container" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause foobar" + echo "$output" + [ "$status" -eq 1 ] +} + +@test "pause a created container by id" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "pause a running container by id" { + skip "Test needs to wait for --force to work for podman rm" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "unpause a running container" { + skip "Test needs to wait for --force to work for podman rm" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + echo "$output" + [ "$status" -eq 1 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm -f $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "remove a paused container by id" { + skip "Test needs to wait for --force to work for podman rm" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + echo "$output" + [ "$status" -eq 1 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm --force $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "stop a paused container created by id" { + skip "Test needs to wait for podman stop to be implemented" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $BB sleep 60" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + echo "$output" + [ "$status" -eq 1 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} unpause $ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter id=$ctr_id" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rm $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_ps.bats b/test/podman_ps.bats new file mode 100644 index 000000000..3b904535c --- /dev/null +++ b/test/podman_ps.bats @@ -0,0 +1,191 @@ +#!/usr/bin/env bats + +load helpers + +IMAGE="redis:alpine" +function setup() { + prepare_network_conf + copy_images +} + +function teardown() { + cleanup_test +} + +@test "podman ps with no containers" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps default" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps all flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps size flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --size" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps quiet flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + ctr_id="$output" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --quiet" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps latest flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --latest" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps last flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${BB} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls -s" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --last 2" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps no-trunc flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --no-trunc" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps namespace flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps --all --namespace" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps namespace flag and format flag = json" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns --format json | python -m json.tool | grep namespace" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps without namespace flag and format flag = json" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --format json | python -m json.tool | grep namespace" + echo "$output" + [ "$status" -eq 1 ] +} + +@test "podman ps format flag = go template" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --format 'table {{.ID}} {{.Image}} {{.Labels}}'" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps filter flag - ancestor" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter ancestor=${ALPINE}" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps filter flag - id" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter id=$ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps filter flag - status" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99" + ctr_id="$output" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --filter status=running" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps short options" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99" + ctr_id="$output" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -aq" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman ps with mutually exclusive flags" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 99" + ctr_id="$output" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -aqs" + echo "$output" + [ "$status" -ne 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns -s" + echo "$output" + [ "$status" -ne 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns format {{.ID}}" + echo "$output" + [ "$status" -ne 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps -a --ns --format json" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_pull.bats b/test/podman_pull.bats new file mode 100644 index 000000000..b0de1a8ab --- /dev/null +++ b/test/podman_pull.bats @@ -0,0 +1,136 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +@test "podman pull from docker with tag" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull debian:6.0.10 + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian:6.0.10 + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull from docker without tag" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS pull debian + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull from a non-docker registry with tag" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS pull registry.fedoraproject.org/fedora:rawhide + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull from a non-docker registry without tag" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS pull registry.fedoraproject.org/fedora + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi registry.fedoraproject.org/fedora + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull using digest" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi alpine:latest + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull from a non existent image" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS pull umohnani/get-started + echo "$output" + [ "$status" -ne 0 ] +} + +@test "podman pull from docker with shortname" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull debian + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi docker.io/debian:latest + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull from docker with shortname and tag" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull debian:6.0.10 + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi docker.io/debian:6.0.10 + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman pull from docker-archive" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alp.tar alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull docker-archive:alp.tar + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + echo "$output" + [ "$status" -eq 0 ] + rm -f alp.tar +} + +@test "podman pull from oci-archive" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-archive -o oci-alp.tar alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull oci-archive:oci-alp.tar + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + echo "$output" + [ "$status" -eq 0 ] + rm -f oci-alp.tar +} + +@test "podman pull from local directory" { + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull alpine + echo "$output" + [ "$status" -eq 0 ] + run mkdir test_pull_dir + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} push alpine dir:test_pull_dir + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi alpine + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull dir:test_pull_dir + echo "$output" + [ "$status" -eq 0 ] + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi test_pull_dir + echo "$output" + [ "$status" -eq 0 ] + rm -rf test_pull_dir +} diff --git a/test/kpod_push.bats b/test/podman_push.bats index 967aa6da3..cc9220bfd 100644 --- a/test/kpod_push.bats +++ b/test/podman_push.bats @@ -11,89 +11,89 @@ function setup() { copy_images } -@test "kpod push to containers/storage" { +@test "podman push to containers/storage" { skip "Issues with bash, skipping" echo # Push the image right back into storage: it now has two names. - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug push $ALPINE containers-storage:busybox:test + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS --log-level=debug push $ALPINE containers-storage:busybox:test echo "$output" [ "$status" -eq 0 ] echo # Try to remove it using the first name. Should be refused. - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi $ALPINE + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS --log-level=debug rmi $ALPINE echo "$output" [ "$status" -ne 0 ] echo # Try to remove it using the second name. Should also be refused. - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi busybox:test + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS --log-level=debug rmi busybox:test echo "$output" [ "$status" -ne 0 ] echo # Force removal despite having multiple names. Should succeed. - run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi -f busybox:test + run ${PODMAN_BINARY} $PODMAN_OPTIONS --log-level=debug rmi -f busybox:test echo "$output" [ "$status" -eq 0 ] } -@test "kpod push to directory" { +@test "podman push to directory" { mkdir /tmp/busybox - run ${KPOD_BINARY} $KPOD_OPTIONS push $ALPINE dir:/tmp/busybox + run ${PODMAN_BINARY} $PODMAN_OPTIONS push $ALPINE dir:/tmp/busybox echo "$output" [ "$status" -eq 0 ] rm -rf /tmp/busybox - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $ALPINE + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } -@test "kpod push to docker archive" { - run ${KPOD_BINARY} $KPOD_OPTIONS push $ALPINE docker-archive:/tmp/busybox-archive:1.26 +@test "podman push to docker archive" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS push $ALPINE docker-archive:/tmp/busybox-archive:1.26 echo "$output" echo "--->" [ "$status" -eq 0 ] rm /tmp/busybox-archive - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $ALPINE + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } -@test "kpod push to oci-archive without compression" { - run ${KPOD_BINARY} $KPOD_OPTIONS push $ALPINE oci-archive:/tmp/oci-busybox.tar:alpine +@test "podman push to oci-archive without compression" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS push $ALPINE oci-archive:/tmp/oci-busybox.tar:alpine echo "$output" [ "$status" -eq 0 ] rm -f /tmp/oci-busybox.tar - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $ALPINE + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } -@test "kpod push without signatures" { +@test "podman push without signatures" { mkdir /tmp/busybox - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS push --remove-signatures $ALPINE dir:/tmp/busybox + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS push --remove-signatures $ALPINE dir:/tmp/busybox echo "$output" [ "$status" -eq 0 ] rm -rf /tmp/busybox - run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $ALPINE + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $ALPINE echo "$output" [ "$status" -eq 0 ] } -@test "kpod push without transport" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull "$ALPINE" +@test "podman push without transport" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS pull "$ALPINE" echo "$output" [ "$status" -eq 0 ] # TODO: The following should fail until a registry is running in Travis CI. - run ${KPOD_BINARY} $KPOD_OPTIONS push "$ALPINE" localhost:5000/my-alpine + run ${PODMAN_BINARY} $PODMAN_OPTIONS push "$ALPINE" localhost:5000/my-alpine echo "$output" [ "$status" -ne 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$ALPINE" + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi "$ALPINE" echo "$output" } @test "push with manifest type conversion" { - run bash -c "${KPOD_BINARY} $KPOD_OPTIONS push --format oci "${BB}" dir:my-dir" + run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS push --format oci "${BB}" dir:my-dir" echo "$output" [ "$status" -eq 0 ] run bash -c "grep "application/vnd.oci.image.config.v1+json" my-dir/manifest.json" echo "$output" [ "$status" -eq 0 ] - run bash -c "${KPOD_BINARY} $KPOD_OPTIONS push --compress --format v2s2 "${BB}" dir:my-dir" + run bash -c "${PODMAN_BINARY} $PODMAN_OPTIONS push --compress --format v2s2 "${BB}" dir:my-dir" echo "$output" [ "$status" -eq 0 ] run bash -c "grep "application/vnd.docker.distribution.manifest.v2+json" my-dir/manifest.json" diff --git a/test/podman_rm.bats b/test/podman_rm.bats new file mode 100644 index 000000000..8ef39435d --- /dev/null +++ b/test/podman_rm.bats @@ -0,0 +1,72 @@ +#!/usr/bin/env bats + +load helpers + +function setup() { + prepare_network_conf + copy_images +} + +function teardown() { + cleanup_test +} + +@test "remove a stopped container" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS run -d ${ALPINE} ls + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rm "$ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "refuse to remove a running container" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS run -d ${ALPINE} sleep 15 + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash ${PODMAN_BINARY} $PODMAN_OPTIONS rm "$ctr_id" + echo "$output" + [ "$status" -ne 0 ] +} + +@test "remove a created container" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rm -f "$ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "remove a running container" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS run -d ${ALPINE} sleep 15 + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c ${PODMAN_BINARY} $PODMAN_OPTIONS rm -f "$ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "remove all containers" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls -l + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB true + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB whoami + run ${PODMAN_BINARY} $PODMAN_OPTIONS rm -a + echo "$output" + [ "$status" -eq 0 ] +} + +@test "remove all containers with one running with short options" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB ls -l + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create $BB whoami + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 30 + run ${PODMAN_BINARY} $PODMAN_OPTIONS rm -af + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_rmi.bats b/test/podman_rmi.bats new file mode 100644 index 000000000..dabf2f0e8 --- /dev/null +++ b/test/podman_rmi.bats @@ -0,0 +1,52 @@ +#!/usr/bin/env bats + +load helpers + +IMAGE1="docker.io/library/alpine:latest" +IMAGE2="docker.io/library/busybox:latest" +IMAGE3="docker.io/library/busybox:glibc" + +function teardown() { + cleanup_test +} + +function pullImages() { + ${PODMAN_BINARY} $PODMAN_OPTIONS pull $IMAGE1 + ${PODMAN_BINARY} $PODMAN_OPTIONS pull $IMAGE2 + ${PODMAN_BINARY} $PODMAN_OPTIONS pull $IMAGE3 +} + +@test "podman rmi bogus image" { + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi debian:6.0.10 + echo "$output" + [ "$status" -eq 1 ] +} + +@test "podman rmi image with fq name" { + pullImages + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi $IMAGE1 + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman rmi image with short name" { + pullImages + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi alpine + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman rmi all images" { + pullImages + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi -a + echo "$output" + [ "$status" -eq 0 ] +} + +@test "podman rmi all images forceably with short options" { + pullImages + ${PODMAN_BINARY} $PODMAN_OPTIONS create ${IMAGE1} ls + run ${PODMAN_BINARY} $PODMAN_OPTIONS rmi -af + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_run.bats b/test/podman_run.bats new file mode 100644 index 000000000..57ae0872e --- /dev/null +++ b/test/podman_run.bats @@ -0,0 +1,138 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "run a container based on local image" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run $BB ls" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "run a container based on local image with short options" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt $BB ls" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "run a container based on a remote image" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${BB_GLIBC} ls" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "run selinux test" { + if [ ! -e /usr/sbin/selinuxenabled ] || [ ! /usr/sbin/selinuxenabled ]; then + skip "SELinux not enabled" + fi + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} cat /proc/self/attr/current" + echo "$output" + firstLabel=$output + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} cat /proc/self/attr/current" + echo "$output" + [ "$output" != "${firstLabel}" ] +} + + +@test "run selinux grep test" { + skip "Until console issues worked out" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -t -i --security-opt label=level:s0:c1,c2 ${ALPINE} cat /proc/self/attr/current | grep s0:c1,c2" + echo "$output" + [ "$status" -eq 0 ] + +} + +@test "run capabilities test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status" + echo "$output" + [ "$status" -eq 0 ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status" + echo "$output" + [ "$status" -eq 0 ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status" + echo "$output" + [ "$status" -eq 0 ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status" + echo "$output" + [ "$status" -eq 0 ] + +} + +@test "run environment test" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --env FOO=BAR ${ALPINE} printenv FOO | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ $output = "BAR" ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --env PATH="/bin" ${ALPINE} printenv PATH | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ $output = "/bin" ] + + run bash -c "export FOO=BAR; ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --env FOO ${ALPINE} printenv FOO | tr -d '\r'" + echo "$output" + [ "$status" -eq 0 ] + [ "$output" = "BAR" ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --env FOO ${ALPINE} printenv" + echo "$output" + [ "$status" -ne 0 ] + +# We don't currently set the hostname in containers, since we are not setting up +# networking. As soon as podman run gets network support we need to uncomment this +# test. +# run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run ${ALPINE} sh -c printenv | grep HOSTNAME" +# echo "$output" +# [ "$status" -eq 0 ] +} + +IMAGE="docker.io/library/fedora:latest" + +@test "run limits test" { + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${IMAGE}" + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ulimit rtprio=99 --cap-add=sys_nice ${IMAGE} cat /proc/self/sched" + echo $output + [ "$status" -eq 0 ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ulimit nofile=2048:2048 ${IMAGE} ulimit -n | tr -d '\r'" + echo $output + [ "$status" -eq 0 ] + [ "$output" = 2048 ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --oom-kill-disable=true ${IMAGE} echo memory-hog" + echo $output + [ "$status" -eq 0 ] + + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --oom-score-adj=100 ${IMAGE} cat /proc/self/oom_score_adj | tr -d '\r'" + echo $output + [ "$status" -eq 0 ] + [ "$output" = 100 ] + +} + +@test "podman run with volume flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -v ${MOUNT_PATH}:/run/test ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime'" + echo $output + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -v ${MOUNT_PATH}:/run/test:ro ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test ro,relatime'" + echo $output + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -v ${MOUNT_PATH}:/run/test:shared ${BB} cat /proc/self/mountinfo | grep '${MOUNT_PATH} /run/test rw,relatime shared:'" + echo $output + [ "$status" -eq 0 ] +} diff --git a/test/kpod_run_ns.bats b/test/podman_run_ns.bats index a1b364f8b..8d1bd4b54 100644 --- a/test/kpod_run_ns.bats +++ b/test/podman_run_ns.bats @@ -13,31 +13,31 @@ function setup() { @test "run pidns test" { - ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE} + ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${ALPINE} - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} sh -c 'echo \$\$'" + run bash -c "${PODMAN_BINARY} ${PODMAN_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 \$\$'" + run bash -c "${PODMAN_BINARY} ${PODMAN_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 $$' + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --pid=badpid ${ALPINE} sh -c 'echo $$' echo $output [ "$status" -ne 0 ] } @test "run ipcns test" { - ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${ALPINE} + ${PODMAN_BINARY} ${PODMAN_OPTIONS} pull ${ALPINE} tmp=$(mktemp /dev/shm/foo.XXXXX) - run ${KPOD_BINARY} ${KPOD_OPTIONS} run --ipc=host ${ALPINE} ls $tmp + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ipc=host ${ALPINE} ls $tmp echo $output out=$(echo $output | tr -d '\r') [ "$status" -eq 0 ] @@ -45,7 +45,7 @@ function setup() { rm -f $tmp - run ${KPOD_BINARY} ${KPOD_OPTIONS} run --ipc=badpid ${ALPINE} sh -c 'echo $$' + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run --ipc=badpid ${ALPINE} sh -c 'echo $$' echo $output [ "$status" -ne 0 ] } diff --git a/test/podman_save.bats b/test/podman_save.bats new file mode 100644 index 000000000..2e03a95cc --- /dev/null +++ b/test/podman_save.bats @@ -0,0 +1,59 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "podman save output flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar $ALPINE" + echo "$output" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman save oci flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar --format oci-archive $ALPINE" + echo "$output" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman save using stdout" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save $ALPINE > alpine.tar" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman save quiet flag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -q -o alpine.tar $ALPINE" + echo "$output" + [ "$status" -eq 0 ] + rm -f alpine.tar +} + +@test "podman save non-existent image" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save -o alpine.tar FOOBAR" + echo "$output" + [ "$status" -ne 0 ] +} + +@test "podman save to directory wit oci format" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format oci-dir -o alp-dir $ALPINE" + echo "$output" + [ "$status" -eq 0 ] + rm -rf alp-dir +} + +@test "podman save to directory wit v2s2 (docker) format" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} save --format docker-dir -o alp-dir $ALPINE" + echo "$output" + [ "$status" -eq 0 ] + rm -rf alp-dir +} diff --git a/test/podman_start.bats b/test/podman_start.bats new file mode 100644 index 000000000..025316462 --- /dev/null +++ b/test/podman_start.bats @@ -0,0 +1,51 @@ +#!/usr/bin/env bats + +load helpers + +function setup() { + prepare_network_conf + copy_images +} + +function teardown() { + cleanup_test +} + +@test "start bogus container" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} start 1234 + echo "$output" + [ "$status" -eq 1 ] +} + +@test "start single container by id" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d ${ALPINE} ls + ctr_id=${output} + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} start $ctr_id + echo "$output" + [ "$status" -eq 0 ] +} + +@test "start single container by name" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d --name foobar99 ${ALPINE} ls + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} start foobar + echo "$output" + [ "$status" -eq 0 ] +} + +@test "start multiple containers" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d ${ALPINE} ls + ctr1_id=${output} + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d ${ALPINE} ls + ctr1_id2=${output} + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} start $ctr1_id $ctr2_id + echo "$output" + [ "$status" -eq 0 ] +} + +@test "start multiple containers -- attach should fail" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name foobar1 -d ${ALPINE} ls + ${PODMAN_BINARY} ${PODMAN_OPTIONS} create --name foobar2 -d ${ALPINE} ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} start -a foobar1 foobar2 + echo "$output" + [ "$status" -eq 1 ] +} diff --git a/test/podman_stats.bats b/test/podman_stats.bats new file mode 100644 index 000000000..f9981227a --- /dev/null +++ b/test/podman_stats.bats @@ -0,0 +1,61 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "stats should run with no containers" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream + echo "$output" + [ "$status" -eq 0 ] +} + +@test "stats with bogus container id" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream 123 + echo "$output" + [ "$status" -eq 1 ] +} + +@test "stats on a running container" { + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t ${ALPINE} sleep 99 + ctr_id="$output" + echo "$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream $ctr_id" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "stats on a running container no id" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t ${ALPINE} sleep 99 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream + echo "$output" + [ "$status" -eq 0 ] +} + +@test "stats on all containers" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t ${ALPINE} ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream -a + echo "$output" + [ "$status" -eq 0 ] +} + +@test "stats only output IDs" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t ${ALPINE} sleep 99 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream --format "{{.Container}}" + echo "$output" + [ "$status" -eq 0 ] +} + +@test "stats json output" { + ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d -t ${ALPINE} ls + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stats --no-stream -a --format json | python -m json.tool" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_stop.bats b/test/podman_stop.bats new file mode 100644 index 000000000..06b001fed --- /dev/null +++ b/test/podman_stop.bats @@ -0,0 +1,50 @@ +#!/usr/bin/env bats + +load helpers + +function teardown() { + cleanup_test +} + +function setup() { + prepare_network_conf + copy_images +} + +@test "stop a bogus container" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop foobar" + echo "$output" + [ "$status" -eq 1 ] +} + +@test "stop a running container by id" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 9999" + [ "$status" -eq 0 ] + ctr_id="$output" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop $ctr_id" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] +} + +@test "stop a running container by name" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop test1" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} ps" + [ "$status" -eq 0 ] +} + +@test "stop all containers" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test1 -d ${ALPINE} sleep 9999" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test2 -d ${ALPINE} sleep 9999" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run --name test3 -d ${ALPINE} sleep 9999" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} stop -a -t 1" + echo "$output" + [ "$status" -eq 0 ] +} diff --git a/test/podman_tag.bats b/test/podman_tag.bats new file mode 100644 index 000000000..79a7f5638 --- /dev/null +++ b/test/podman_tag.bats @@ -0,0 +1,50 @@ +#!/usr/bin/env bats + +load helpers + +IMAGE="alpine:latest" + +function teardown() { + cleanup_test +} + +@test "podman tag with shortname:latest" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pull $IMAGE" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} tag $IMAGE foobar:latest" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest" + [ "$status" -eq 0 ] +} + +@test "podman tag with shortname" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pull $IMAGE" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} tag $IMAGE foobar" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:latest" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:latest" + [ "$status" -eq 0 ] +} + +@test "podman tag with shortname:tag" { + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} pull $IMAGE" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} tag $IMAGE foobar:v" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect foobar:v" + echo "$output" + [ "$status" -eq 0 ] + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} rmi --force foobar:v" + [ "$status" -eq 0 ] +} diff --git a/test/kpod_top.bats b/test/podman_top.bats index 9d54908bc..1d3df149d 100644 --- a/test/kpod_top.bats +++ b/test/podman_top.bats @@ -12,41 +12,41 @@ function setup() { } @test "top without container name or id" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} top + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top echo "$output" [ "$status" -eq 1 ] } @test "top a bogus container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} top foobar + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} top foobar echo "$output" [ "$status" -eq 1 ] } @test "top non-running container by id with defaults" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} create -d ${ALPINE} sleep 60 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} create -d ${ALPINE} sleep 60 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} top $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id" echo "$output" [ "$status" -eq 1 ] } @test "top running container by id with defaults" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -dt ${ALPINE} /bin/sh + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -dt ${ALPINE} /bin/sh [ "$status" -eq 0 ] ctr_id="$output" echo $ctr_id - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} top $ctr_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id" echo "$output" [ "$status" -eq 0 ] } @test "top running container by id with ps opts" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 60 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 60 [ "$status" -eq 0 ] ctr_id="$output" - run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} top $ctr_id -o fuser,f,comm,label" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} top $ctr_id -o fuser,f,comm,label" echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_version.bats b/test/podman_version.bats index b0e7a3d13..0f959277b 100644 --- a/test/kpod_version.bats +++ b/test/podman_version.bats @@ -6,8 +6,8 @@ function teardown() { cleanup_test } -@test "kpod version test" { - run bash -c "${KPOD_BINARY} version" +@test "podman version test" { + run bash -c "${PODMAN_BINARY} version" echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_wait.bats b/test/podman_wait.bats index 871c9f5bf..823a8591f 100644 --- a/test/kpod_wait.bats +++ b/test/podman_wait.bats @@ -12,26 +12,26 @@ function teardown() { } @test "wait on a bogus container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} wait 12343 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait 12343 echo $output echo $status [ "$status" -eq 1 ] } @test "wait on a stopped container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} ls + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} ls echo $output [ "$status" -eq 0 ] ctr_id=${output} - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait $ctr_id [ "$status" -eq 0 ] } @test "wait on a sleeping container" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run -d ${ALPINE} sleep 10 + run ${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d ${ALPINE} sleep 10 echo $output [ "$status" -eq 0 ] ctr_id=${output} - run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id + run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} wait $ctr_id [ "$status" -eq 0 ] } |