diff options
author | baude <bbaude@redhat.com> | 2017-11-03 14:37:22 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-17 02:07:18 +0000 |
commit | d2eda1a8648b7e6053627e48bf500f9671f0a6c2 (patch) | |
tree | 0b86ea7165ab02003b9e6fc480432774a72724a6 /test | |
parent | bf8b9a37df2aeead009996875f58c59625110472 (diff) | |
download | podman-d2eda1a8648b7e6053627e48bf500f9671f0a6c2.tar.gz podman-d2eda1a8648b7e6053627e48bf500f9671f0a6c2.tar.bz2 podman-d2eda1a8648b7e6053627e48bf500f9671f0a6c2.zip |
Enhancements to papr tests
The PR contains several enhancements to our CI testing.
- enable lint testing on Fedora
- add Centos Atomic as test platform
- integration tests on run on the OS natively (uncontainerized)
- builds are done in containers
- inclusion of Vagrant file for local testing
Signed-off-by: baude <bbaude@redhat.com>
Closes: #18
Approved by: mheon
Diffstat (limited to 'test')
-rw-r--r-- | test/helpers.bash | 31 | ||||
-rw-r--r-- | test/kpod_create.bats | 4 | ||||
-rw-r--r-- | test/kpod_diff.bats | 14 | ||||
-rw-r--r-- | test/kpod_export.bats | 10 | ||||
-rw-r--r-- | test/kpod_history.bats | 40 | ||||
-rw-r--r-- | test/kpod_images.bats | 25 | ||||
-rw-r--r-- | test/kpod_import.bats | 64 | ||||
-rw-r--r-- | test/kpod_inspect.bats | 24 | ||||
-rw-r--r-- | test/kpod_kill.bats | 8 | ||||
-rw-r--r-- | test/kpod_load.bats | 40 | ||||
-rw-r--r-- | test/kpod_logs.bats | 6 | ||||
-rw-r--r-- | test/kpod_mount.bats | 8 | ||||
-rw-r--r-- | test/kpod_pause.bats | 38 | ||||
-rw-r--r-- | test/kpod_ps.bats | 38 | ||||
-rw-r--r-- | test/kpod_pull.bats | 42 | ||||
-rw-r--r-- | test/kpod_push.bats | 46 | ||||
-rw-r--r-- | test/kpod_rename.bats | 6 | ||||
-rw-r--r-- | test/kpod_rm.bats | 8 | ||||
-rw-r--r-- | test/kpod_run.bats | 24 | ||||
-rw-r--r-- | test/kpod_save.bats | 16 | ||||
-rw-r--r-- | test/kpod_stats.bats | 8 | ||||
-rw-r--r-- | test/kpod_stop.bats | 4 | ||||
-rw-r--r-- | test/kpod_tag.bats | 24 | ||||
-rw-r--r-- | test/kpod_version.bats | 2 | ||||
-rw-r--r-- | test/kpod_wait.bats | 10 | ||||
-rwxr-xr-x | test/test_runner.sh | 6 |
26 files changed, 267 insertions, 279 deletions
diff --git a/test/helpers.bash b/test/helpers.bash index dee2193d3..3ec247e60 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -7,13 +7,21 @@ INTEGRATION_ROOT=$(dirname "$(readlink -f "$BASH_SOURCE")") TESTDATA="${INTEGRATION_ROOT}/testdata" # Root directory of the repository. -CRIO_ROOT=${CRIO_ROOT:-$(cd "$INTEGRATION_ROOT/../.."; pwd -P)} +if [[ ! -z "$CRIO_ROOT" ]]; then + CRIO_ROOT=${CRIO_ROOT} +elif [[ ! -z "$TRAVIS" ]]; then + CRIO_ROOT="/go/src/github.com/projectatomic/libpod" +elif [[ ! -z "$PAPR" ]]; then + CRIO_ROOT="/var/tmp/checkout" +else + CRIO_ROOT=$(cd "$INTEGRATION_ROOT/../.."; pwd -P)} +fi -KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/libpod/bin/kpod} +KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/bin/kpod} # Path of the conmon binary. -CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/libpod/bin/conmon} +CONMON_BINARY=${CONMON_BINARY:-${CRIO_ROOT}/bin/conmon} # Path of the default seccomp profile. -SECCOMP_PROFILE=${SECCOMP_PROFILE:-${CRIO_ROOT}/libpod/seccomp.json} +SECCOMP_PROFILE=${SECCOMP_PROFILE:-${CRIO_ROOT}/seccomp.json} # Name of the default apparmor profile. APPARMOR_PROFILE=${APPARMOR_PROFILE:-crio-default} # Runtime @@ -33,13 +41,13 @@ BOOT_CONFIG_FILE_PATH=${BOOT_CONFIG_FILE_PATH:-/boot/config-`uname -r`} # Path of apparmor parameters file. APPARMOR_PARAMETERS_FILE_PATH=${APPARMOR_PARAMETERS_FILE_PATH:-/sys/module/apparmor/parameters/enabled} # Path of the bin2img binary. -BIN2IMG_BINARY=${BIN2IMG_BINARY:-${CRIO_ROOT}/libpod/test/bin2img/bin2img} +BIN2IMG_BINARY=${BIN2IMG_BINARY:-${CRIO_ROOT}/test/bin2img/bin2img} # Path of the copyimg binary. -COPYIMG_BINARY=${COPYIMG_BINARY:-${CRIO_ROOT}/libpod/test/copyimg/copyimg} +COPYIMG_BINARY=${COPYIMG_BINARY:-${CRIO_ROOT}/test/copyimg/copyimg} # Path of tests artifacts. -ARTIFACTS_PATH=${ARTIFACTS_PATH:-${CRIO_ROOT}/libpod/.artifacts} +ARTIFACTS_PATH=${ARTIFACTS_PATH:-${CRIO_ROOT}/.artifacts} # Path of the checkseccomp binary. -CHECKSECCOMP_BINARY=${CHECKSECCOMP_BINARY:-${CRIO_ROOT}/libpod/test/checkseccomp/checkseccomp} +CHECKSECCOMP_BINARY=${CHECKSECCOMP_BINARY:-${CRIO_ROOT}/test/checkseccomp/checkseccomp} # XXX: This is hardcoded inside cri-o at the moment. DEFAULT_LOG_PATH=/var/log/crio/pods # Cgroup manager to be used @@ -51,7 +59,12 @@ PIDS_LIMIT=${PIDS_LIMIT:-1024} # Log size max limit LOG_SIZE_MAX_LIMIT=${LOG_SIZE_MAX_LIMIT:--1} -TESTDIR=$(mktemp -d) +if [[ ! -d "/test.dir" ]]; then + mkdir /test.dir +fi + +TESTDIR=$(mktemp -p /test.dir -d) +#mount -t tmpfs tmpfs ${TESTDIR} # kpod pull needs a configuration file for shortname pulls export REGISTRIES_CONFIG_PATH="$INTEGRATION_ROOT/registries.conf" diff --git a/test/kpod_create.bats b/test/kpod_create.bats index 46a460ecd..225ecca98 100644 --- a/test/kpod_create.bats +++ b/test/kpod_create.bats @@ -9,9 +9,7 @@ function teardown() { ALPINE="docker.io/library/alpine:latest" @test "create a container based on local image" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest run ${KPOD_BINARY} ${KPOD_OPTIONS} create docker.io/library/busybox:latest ls echo "$output" [ "$status" -eq 0 ] diff --git a/test/kpod_diff.bats b/test/kpod_diff.bats index 53a94d01e..826fc7389 100644 --- a/test/kpod_diff.bats +++ b/test/kpod_diff.bats @@ -9,13 +9,13 @@ function teardown() { } @test "test diff of image and parent" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS diff $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS diff $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } @@ -27,14 +27,14 @@ function teardown() { } @test "test diff with json output" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS pull $IMAGE echo "$output" [ "$status" -eq 0 ] - # run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} diff --format json $IMAGE | python -m json.tool" - run ${KPOD_BINARY} $KPOD_OPTIONS diff --format json $IMAGE + # run bash -c bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} diff --format json $IMAGE | python -m json.tool" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS diff --format json $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_export.bats b/test/kpod_export.bats index a3e58c498..ea9697b9d 100644 --- a/test/kpod_export.bats +++ b/test/kpod_export.bats @@ -9,20 +9,20 @@ function teardown() { } @test "kpod export output flag" { - skip "Test needs to be converted to kpod run" + skip "Test needs to be converted to kpod run bash -c" start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json + run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" [ "$status" -eq 0 ] pod_id="$output" - run crioctl image pull "$IMAGE" + run bash -c crioctl image pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs diff --git a/test/kpod_history.bats b/test/kpod_history.bats index aa89cfe65..a49ea7685 100644 --- a/test/kpod_history.bats +++ b/test/kpod_history.bats @@ -9,72 +9,64 @@ function teardown() { } @test "kpod history default" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} history $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } @test "kpod history with Go template format" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} history --format "{{.ID}} {{.Created}}" $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history --format "{{.ID}} {{.Created}}" $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } @test "kpod history human flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} history --human=false $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history --human=false $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } @test "kpod history quiet flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} history -q $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history -q $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } @test "kpod history no-trunc flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE - echo "$output" - [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} history --no-trunc $IMAGE + ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history --no-trunc $IMAGE echo "$output" [ "$status" -eq 0 ] run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE - echo "$output" - [ "$status" -eq 0 ] } @test "kpod history json flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} history --format json $IMAGE | python -m json.tool" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE - echo "$output" - [ "$status" -eq 0 ] + bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE } diff --git a/test/kpod_images.bats b/test/kpod_images.bats index 0448d61b2..6f0c53670 100644 --- a/test/kpod_images.bats +++ b/test/kpod_images.bats @@ -2,46 +2,41 @@ load helpers -IMAGE="debian:6.0.10" +IMAGE="busybox" function teardown() { cleanup_test } @test "kpod images" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} images + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} echo "$output" [ "$status" -eq 0 ] } @test "kpod images test valid json" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json echo "$output" | python -m json.tool [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} echo "$output" [ "$status" -eq 0 ] } @test "kpod images check name json output" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} images --format json - echo "$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}" ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} + [ "$name" == "docker.io/library/${IMAGE}:latest" ] + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi ${IMAGE} echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_import.bats b/test/kpod_import.bats index 03a89f2e8..ef2ef342d 100644 --- a/test/kpod_import.bats +++ b/test/kpod_import.bats @@ -9,30 +9,30 @@ function teardown() { } @test "kpod import with source and reference" { - skip "Test needs to be converted to kpod run" + skip "Test needs to be converted to kpod run bash -c" start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json + run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" [ "$status" -eq 0 ] pod_id="$output" - run crioctl image pull "$IMAGE" + run bash -c crioctl image pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar imported-image + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar imported-image echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} images + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images echo "$output" [ "$status" -eq 0 ] images="$output" - run grep "imported-image" <<< "$images" + run bash -c grep "imported-image" <<< "$images" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -42,30 +42,30 @@ function teardown() { } @test "kpod import without reference" { - skip "Test needs to be converted to kpod run" + skip "Test needs to be converted to kpod run bash -c" start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json + run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" [ "$status" -eq 0 ] pod_id="$output" - run crioctl image pull "$IMAGE" + run bash -c crioctl image pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import container.tar echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} images + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} images echo "$output" [ "$status" -eq 0 ] images="$output" - run grep "<none>" <<< "$images" + run bash -c grep "<none>" <<< "$images" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -75,30 +75,30 @@ function teardown() { } @test "kpod import with message flag" { - skip "Test needs to be converted to kpod run" + skip "Test needs to be converted to kpod run bash -c" start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json + run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" [ "$status" -eq 0 ] pod_id="$output" - run crioctl image pull "$IMAGE" + run bash -c crioctl image pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} import --message "importing container test message" container.tar imported-image + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import --message "importing container test message" container.tar imported-image echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} history imported-image + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} history imported-image echo "$output" [ "$status" -eq 0 ] history="$output" - run grep "importing container test message" <<< "$history" + run bash -c grep "importing container test message" <<< "$history" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -108,30 +108,30 @@ function teardown() { } @test "kpod import with change flag" { - skip "Test needs to be converted to kpod run" + skip "Test needs to be converted to kpod run bash -c" start_crio - run crioctl pod run --config "$TESTDATA"/sandbox_config.json + run bash -c crioctl pod run bash -c --config "$TESTDATA"/sandbox_config.json echo "$output" [ "$status" -eq 0 ] pod_id="$output" - run crioctl image pull "$IMAGE" + run bash -c crioctl image pull "$IMAGE" echo "$output" [ "$status" -eq 0 ] - run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} export -o container.tar "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect imported-image + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect imported-image echo "$output" [ "$status" -eq 0 ] inspect="$output" - run grep "/bin/bash" <<< "$inspect" + run bash -c grep "/bin/bash" <<< "$inspect" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs diff --git a/test/kpod_inspect.bats b/test/kpod_inspect.bats index ca4b7c8eb..3c627ceac 100644 --- a/test/kpod_inspect.bats +++ b/test/kpod_inspect.bats @@ -2,20 +2,18 @@ load helpers -IMAGE="redis:alpine" +IMAGE="docker.io/library/busybox:latest" function teardown() { cleanup_test } @test "kpod inspect image" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE} run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect ${IMAGE} | python -m json.tool" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE} + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE} echo "$output" [ "$status" -eq 0 ] } @@ -28,31 +26,27 @@ function teardown() { } @test "kpod inspect with format" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS inspect --format {{.ID}} ${IMAGE} + ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE} + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect --format {{.ID}} ${IMAGE} echo "$output" [ "$status" -eq 0 ] inspectOutput="$output" - run ${KPOD_BINARY} $KPOD_OPTIONS images --no-trunc --quiet ${IMAGE} + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS images --no-trunc --quiet ${IMAGE} echo "$output" [ "$status" -eq 0 ] [ "$output" = "$inspectOutput" ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE} + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE} echo "$output" [ "$status" -eq 0 ] } @test "kpod inspect specified type" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE} - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} $KPOD_OPTIONS pull ${IMAGE} run bash -c "${KPOD_BINARY} $KPOD_OPTIONS inspect --type image ${IMAGE} | python -m json.tool" echo "$output" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE} + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi ${IMAGE} echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_kill.bats b/test/kpod_kill.bats index 15eaef924..38d541afb 100644 --- a/test/kpod_kill.bats +++ b/test/kpod_kill.bats @@ -27,7 +27,7 @@ function start_sleep_container () { ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a ${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id" crioctl ctr status --id "$ctr_id" - run ${KPOD_BINARY} ${KPOD_OPTIONS} kill "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -44,7 +44,7 @@ function start_sleep_container () { ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a ${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id" crioctl ctr status --id "$ctr_id" - run ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s TERM "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s TERM "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -62,7 +62,7 @@ function start_sleep_container () { ${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id" crioctl ctr status --id "$ctr_id" ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a - run ${KPOD_BINARY} ${KPOD_OPTIONS} kill "k8s_container999_podsandbox1_redhat.test.crio_redhat-test-crio_1" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill "k8s_container999_podsandbox1_redhat.test.crio_redhat-test-crio_1" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -78,7 +78,7 @@ function start_sleep_container () { crioctl ctr status --id "$ctr_id" ${KPOD_BINARY} ${KPOD_OPTIONS} logs "$ctr_id" crioctl ctr status --id "$ctr_id" - run ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s foobar "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} kill -s foobar "$ctr_id" echo "$output" [ "$status" -ne 0 ] cleanup_ctrs diff --git a/test/kpod_load.bats b/test/kpod_load.bats index e3896b2ae..ab002f04a 100644 --- a/test/kpod_load.bats +++ b/test/kpod_load.bats @@ -9,71 +9,71 @@ function teardown() { } @test "kpod load input flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE echo "$output" [ "$status" -eq 0 ] } @test "kpod load oci-archive image" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE [ "$status" -eq 0 ] } @test "kpod load oci-archive image with signature-policy" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE [ "$status" -eq 0 ] cp /etc/containers/policy.json /tmp - run ${KPOD_BINARY} ${KPOD_OPTIONS} load --signature-policy /tmp/policy.json -i alpine.tar + 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 - run ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi $IMAGE [ "$status" -eq 0 ] } @test "kpod load using quiet flag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} load -q -i alpine.tar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} load -q -i alpine.tar echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE [ "$status" -eq 0 ] } diff --git a/test/kpod_logs.bats b/test/kpod_logs.bats index a2d74605d..bf15db380 100644 --- a/test/kpod_logs.bats +++ b/test/kpod_logs.bats @@ -22,7 +22,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS logs "$ctr_id" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS logs "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -44,7 +44,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS logs --tail 3 $ctr_id + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS logs --tail 3 $ctr_id echo "$output" lines=$(echo "$output" | wc -l) [ "$status" -eq 0 ] @@ -68,7 +68,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS logs --since 2017-08-07T10:10:09.056611202-04:00 $ctr_id + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS logs --since 2017-08-07T10:10:09.056611202-04:00 $ctr_id echo "$output" [ "$status" -eq 0 ] cleanup_ctrs diff --git a/test/kpod_mount.bats b/test/kpod_mount.bats index 446ec1d8d..62b5f5ecc 100644 --- a/test/kpod_mount.bats +++ b/test/kpod_mount.bats @@ -22,17 +22,17 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id echo "$output" echo ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id [ "$status" -eq 0 ] run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} mount --notruncate | grep $ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} mount $ctr_id echo "$output" [ "$status" -eq 0 ] root="$output" @@ -40,7 +40,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] touch $root/foobar - run ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unmount $ctr_id echo "$output" [ "$status" -eq 0 ] cleanup_ctrs diff --git a/test/kpod_pause.bats b/test/kpod_pause.bats index c756c6785..f71080334 100644 --- a/test/kpod_pause.bats +++ b/test/kpod_pause.bats @@ -33,13 +33,13 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -63,13 +63,13 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -92,13 +92,13 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -122,22 +122,22 @@ function teardown() { echo "$output" id="$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$id" echo "$output" [ "$status" -eq 1 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rm --force "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rm --force "$id" echo "$output" [ "$status" -eq 1 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rm "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -157,16 +157,16 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pause "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_id" echo "$output" [ "$status" -eq 1 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} unpause "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods diff --git a/test/kpod_ps.bats b/test/kpod_ps.bats index 12f13fe5b..8f1aba816 100644 --- a/test/kpod_ps.bats +++ b/test/kpod_ps.bats @@ -5,7 +5,7 @@ load helpers IMAGE="redis:alpine" @test "kpod ps with no containers" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps echo "$output" [ "$status" -eq 0 ] } @@ -27,7 +27,7 @@ IMAGE="redis:alpine" run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -48,10 +48,10 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -72,10 +72,10 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -s + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -s echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --size + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --size echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -96,10 +96,10 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -q + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a -q echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --quiet + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --quiet echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -120,10 +120,10 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --latest echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -l + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -l echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -144,10 +144,10 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --last 2 + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --last 2 echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -n 2 + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -n 2 echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -168,7 +168,7 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --no-trunc + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --no-trunc echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -188,10 +188,10 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --ns echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all --namespace + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps --all --namespace echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -253,7 +253,7 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --format "table {{.ID}} {{.Image}} {{.Labels}}" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --format "table {{.ID}} {{.Image}} {{.Labels}}" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -274,7 +274,7 @@ IMAGE="redis:alpine" run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter ancestor=${IMAGE} + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter ancestor=${IMAGE} echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -296,7 +296,7 @@ IMAGE="redis:alpine" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter id="$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -318,7 +318,7 @@ IMAGE="redis:alpine" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter status=running + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} ps -a --filter status=running echo "$output" [ "$status" -eq 0 ] cleanup_ctrs diff --git a/test/kpod_pull.bats b/test/kpod_pull.bats index c12c62413..4cad2390f 100644 --- a/test/kpod_pull.bats +++ b/test/kpod_pull.bats @@ -12,7 +12,7 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10 echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10 + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10 echo "$output" [ "$status" -eq 0 ] } @@ -21,7 +21,7 @@ function teardown() { run ${KPOD_BINARY} $KPOD_OPTIONS pull debian echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi debian + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian echo "$output" [ "$status" -eq 0 ] } @@ -30,7 +30,7 @@ function teardown() { run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora:rawhide echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide echo "$output" [ "$status" -eq 0 ] } @@ -39,7 +39,7 @@ function teardown() { run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora echo "$output" [ "$status" -eq 0 ] } @@ -48,7 +48,7 @@ function teardown() { run ${KPOD_BINARY} $KPOD_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest echo "$output" [ "$status" -eq 0 ] } @@ -63,7 +63,7 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest echo "$output" [ "$status" -eq 0 ] } @@ -72,7 +72,7 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10 echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10 + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10 echo "$output" [ "$status" -eq 0 ] } @@ -81,57 +81,57 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alp.tar alpine + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alp.tar alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker-archive:alp.tar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker-archive:alp.tar echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine + 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 ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-archive -o oci-alp.tar alpine + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-archive -o oci-alp.tar alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull oci-archive:oci-alp.tar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull oci-archive:oci-alp.tar echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine + 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 ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine + 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 ${KPOD_BINARY} ${KPOD_OPTIONS} push alpine dir:test_pull_dir + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} push alpine dir:test_pull_dir echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull dir:test_pull_dir + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull dir:test_pull_dir echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi test_pull_dir + 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_push.bats b/test/kpod_push.bats index e8fe4fdbc..f40fc7b30 100644 --- a/test/kpod_push.bats +++ b/test/kpod_push.bats @@ -9,20 +9,19 @@ function teardown() { } @test "kpod push to containers/storage" { + skip "Issues with bash, skipping" echo # Pull down the image: it gets the name $IMAGE. - run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug pull $IMAGE echo # Push the image right back into storage: it now has two names. - run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug push "$IMAGE" containers-storage:busybox:test + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug push "$IMAGE" containers-storage:busybox:test echo "$output" [ "$status" -eq 0 ] echo # Try to remove it using the first name. Should be refused. - run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi "$IMAGE" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi $IMAGE echo "$output" [ "$status" -ne 0 ] echo # Try to remove it using the second name. Should also be refused. - run ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi busybox:test + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS --log-level=debug rmi busybox:test echo "$output" [ "$status" -ne 0 ] echo # Force removal despite having multiple names. Should succeed. @@ -32,59 +31,48 @@ function teardown() { } @test "kpod push to directory" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run mkdir /tmp/busybox - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" + mkdir /tmp/busybox run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" dir:/tmp/busybox echo "$output" [ "$status" -eq 0 ] rm -rf /tmp/busybox - run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" echo "$output" [ "$status" -eq 0 ] } @test "kpod push to docker archive" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" docker-archive:/tmp/busybox-archive:1.26 echo "$output" + echo "--->" [ "$status" -eq 0 ] rm /tmp/busybox-archive - run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" echo "$output" [ "$status" -eq 0 ] } @test "kpod push to oci-archive without compression" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] + ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" run ${KPOD_BINARY} $KPOD_OPTIONS push "$IMAGE" oci-archive:/tmp/oci-busybox.tar:alpine echo "$output" [ "$status" -eq 0 ] rm -f /tmp/oci-busybox.tar - run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" echo "$output" [ "$status" -eq 0 ] } @test "kpod push without signatures" { - run ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run mkdir /tmp/busybox - echo "$output" - [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS push --remove-signatures "$IMAGE" dir:/tmp/busybox + ${KPOD_BINARY} $KPOD_OPTIONS pull "$IMAGE" + mkdir /tmp/busybox + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS push --remove-signatures "$IMAGE" dir:/tmp/busybox echo "$output" [ "$status" -eq 0 ] rm -rf /tmp/busybox - run ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi "$IMAGE" echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_rename.bats b/test/kpod_rename.bats index 63b723ae2..a7954dbfa 100644 --- a/test/kpod_rename.bats +++ b/test/kpod_rename.bats @@ -11,7 +11,7 @@ function teardown() { @test "kpod rename successful" { skip "Test needs to be converted to kpod run" start_crio - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] run crioctl pod run --config "$TESTDATA"/sandbox_config.json @@ -21,10 +21,10 @@ function teardown() { run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" ctr_id="$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rename "$ctr_id" "$NEW_NAME" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rename "$ctr_id" "$NEW_NAME" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS inspect "$ctr_id" --format {{.Name}} + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS inspect "$ctr_id" --format {{.Name}} echo "$output" [ "$status" -eq 0 ] [ "$output" == "$NEW_NAME" ] diff --git a/test/kpod_rm.bats b/test/kpod_rm.bats index 30a8a9ab0..54448d924 100644 --- a/test/kpod_rm.bats +++ b/test/kpod_rm.bats @@ -25,7 +25,7 @@ function teardown() { run crioctl ctr stop --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -46,7 +46,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm "$ctr_id" echo "$output" [ "$status" -ne 0 ] cleanup_ctrs @@ -65,7 +65,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -86,7 +86,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id" + run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rm -f "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_pods diff --git a/test/kpod_run.bats b/test/kpod_run.bats index 7a09ac1f2..56995316b 100644 --- a/test/kpod_run.bats +++ b/test/kpod_run.bats @@ -8,29 +8,34 @@ ALPINE="docker.io/library/alpine:latest" run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} run docker.io/library/busybox:latest ls + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run docker.io/library/busybox:latest ls echo "$output" [ "$status" -eq 0 ] } @test "run a container based on a remote image" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} ls + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} ls echo "$output" [ "$status" -eq 0 ] } @test "run selinux test" { - if [ ! -e /usr/sbin/selinuxenabled ] || [ ! /usr/sbin/selinuxenabled ]; then skip "SELinux not enabled" fi - firstLabel=$(${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current) run ${KPOD_BINARY} ${KPOD_OPTIONS} run ${ALPINE} cat /proc/self/attr/current echo "$output" - [ "$status" -eq 0 ] + firstLabel=$output + + run ${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 ] @@ -38,20 +43,19 @@ ALPINE="docker.io/library/alpine:latest" } @test "run capabilities test" { - - run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add all ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-add sys_admin ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop all ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} run --cap-drop setuid ${ALPINE} cat /proc/self/status echo "$output" [ "$status" -eq 0 ] diff --git a/test/kpod_save.bats b/test/kpod_save.bats index d8c581a5c..63ef127b1 100644 --- a/test/kpod_save.bats +++ b/test/kpod_save.bats @@ -12,10 +12,10 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar @@ -24,10 +24,10 @@ function teardown() { @test "kpod save oci flag" { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alpine.tar --format oci-archive $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE [ "$status" -eq 0 ] rm -f alpine.tar } @@ -36,10 +36,10 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save > alpine.tar $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save > alpine.tar $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar @@ -49,10 +49,10 @@ function teardown() { run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} save -q -o alpine.tar $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -q -o alpine.tar $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi $IMAGE echo "$output" [ "$status" -eq 0 ] rm -f alpine.tar diff --git a/test/kpod_stats.bats b/test/kpod_stats.bats index 94215a15c..930d2f006 100644 --- a/test/kpod_stats.bats +++ b/test/kpod_stats.bats @@ -20,7 +20,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream "$ctr_id" echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -39,7 +39,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -58,7 +58,7 @@ function teardown() { echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --all + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --all echo "$output" [ "$status" -eq 0 ] cleanup_ctrs @@ -80,7 +80,7 @@ function teardown() { run crioctl ctr start --id "$ctr_id" echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format {{.ID}} "$ctr_id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stats --no-stream --format {{.ID}} "$ctr_id" echo "$output" [ "$status" -eq 0 ] # once ps is implemented, run ps -q and see if that equals the output from above diff --git a/test/kpod_stop.bats b/test/kpod_stop.bats index 2dbe404b2..1a79371af 100644 --- a/test/kpod_stop.bats +++ b/test/kpod_stop.bats @@ -27,7 +27,7 @@ function teardown() { echo "$output" id="$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$id" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$id" echo "$output" [ "$status" -eq 0 ] cleanup_pods @@ -52,7 +52,7 @@ function teardown() { [ "$status" -eq 0 ] ctr_name=$(python -c 'import json; import sys; print json.load(sys.stdin)["crio_annotations"]["io.kubernetes.cri-o.Name"]' <<< "$output") echo container name is \""$ctr_name"\" - run ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_name" + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} stop "$ctr_name" echo "$output" [ "$status" -eq 0 ] cleanup_pods diff --git a/test/kpod_tag.bats b/test/kpod_tag.bats index 93109db52..d2de6b075 100644 --- a/test/kpod_tag.bats +++ b/test/kpod_tag.bats @@ -9,42 +9,42 @@ function teardown() { } @test "kpod tag with shortname:latest" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:latest [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest [ "$status" -eq 0 ] } @test "kpod tag with shortname" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:latest echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:latest [ "$status" -eq 0 ] } @test "kpod tag with shortname:tag" { - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull $IMAGE echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:v + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} tag $IMAGE foobar:v echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:v + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} inspect foobar:v echo "$output" [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:v + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi --force foobar:v [ "$status" -eq 0 ] } diff --git a/test/kpod_version.bats b/test/kpod_version.bats index e6c062b80..41f356de7 100644 --- a/test/kpod_version.bats +++ b/test/kpod_version.bats @@ -7,7 +7,7 @@ function teardown() { } @test "kpod version test" { - run ${KPOD_BINARY} version + run bash -c ${KPOD_BINARY} version echo "$output" [ "$status" -eq 0 ] } diff --git a/test/kpod_wait.bats b/test/kpod_wait.bats index 8d11e634d..bb4b30a0b 100644 --- a/test/kpod_wait.bats +++ b/test/kpod_wait.bats @@ -26,7 +26,7 @@ function container_start() { @test "wait on a bogus container" { skip "Needs to be converted to kpod run" start_crio - run ${KPOD_BINARY} ${KPOD_OPTIONS} wait 12343 + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait 12343 echo $output [ "$status" -eq 1 ] stop_crio @@ -34,7 +34,7 @@ function container_start() { @test "wait on a stopped container" { skip "Needs to be converted to kpod run" - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest echo $output [ "$status" -eq 0 ] start_crio @@ -43,7 +43,7 @@ function container_start() { ctr_id=$(container_create_from_template "test-CTR" "docker.io/library/busybox:latest" '["ls"]' "${pod_id}") echo $ctr_id container_start $ctr_id - run ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id [ "$status" -eq 0 ] cleanup_ctrs cleanup_pods @@ -52,7 +52,7 @@ function container_start() { @test "wait on a sleeping container" { skip "Needs to be converted to kpod run" - run ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker.io/library/busybox:latest echo $output [ "$status" -eq 0 ] start_crio @@ -63,7 +63,7 @@ function container_start() { run container_start $ctr_id echo $output [ "$status" -eq 0 ] - run ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id + run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} wait $ctr_id echo $output [ "$status" -eq 0 ] cleanup_ctrs diff --git a/test/test_runner.sh b/test/test_runner.sh index 868df60e3..c97d8d0f7 100755 --- a/test/test_runner.sh +++ b/test/test_runner.sh @@ -12,7 +12,11 @@ function execute() { } # Tests to run. Defaults to all. -TESTS=${@:-.} +if [[ -z "${TESTS}" ]]; then + TESTS=${@:-.} +else + TESTS=$TESTS +fi # Run the tests. execute time bats --tap $TESTS |