diff options
author | Yiqiao Pu <ypu@redhat.com> | 2018-01-15 16:10:56 +0800 |
---|---|---|
committer | Yiqiao Pu <ypu@redhat.com> | 2018-01-23 13:58:16 +0800 |
commit | cae415b91cf81416ad7d89f9b3ba16a26ae28fc5 (patch) | |
tree | a48ee915054c261ce76304bc8f88ff1e13c933dd | |
parent | 7853262a84b1312e29a78708865a28bd41c4cc2f (diff) | |
download | podman-cae415b91cf81416ad7d89f9b3ba16a26ae28fc5.tar.gz podman-cae415b91cf81416ad7d89f9b3ba16a26ae28fc5.tar.bz2 podman-cae415b91cf81416ad7d89f9b3ba16a26ae28fc5.zip |
Update podman_import test to use podman
Update the podman_import test to use podman run, and update the
check method for string check method.
Signed-off-by: Yiqiao Pu <ypu@redhat.com>
-rw-r--r-- | test/podman_import.bats | 102 |
1 files changed, 20 insertions, 82 deletions
diff --git a/test/podman_import.bats b/test/podman_import.bats index 6303141c9..69c704a68 100644 --- a/test/podman_import.bats +++ b/test/podman_import.bats @@ -2,8 +2,6 @@ load helpers -IMAGE="redis:alpine" - function teardown() { cleanup_test } @@ -13,133 +11,73 @@ function setup() { } @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" - [ "$status" -eq 0 ] - pod_id="$output" - run bash -c crioctl image pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar imported-image + run bash -cp "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} images + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar imported-image" echo "$output" [ "$status" -eq 0 ] - images="$output" - run bash -c grep "imported-image" <<< "$images" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images" echo "$output" [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio + [[ "$output" == *"imported-image"* ]] rm -f container.tar } @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" - [ "$status" -eq 0 ] - pod_id="$output" - run bash -c crioctl image pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} images + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import container.tar" echo "$output" [ "$status" -eq 0 ] - images="$output" - run bash -c grep "<none>" <<< "$images" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} images" echo "$output" [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio + [[ "$output" == *"<none>"* ]] rm -f container.tar } @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" - [ "$status" -eq 0 ] - pod_id="$output" - run bash -c crioctl image pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import --message "importing container test message" container.tar imported-image + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} history imported-image + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import --message 'importing container test message' container.tar imported-image" echo "$output" [ "$status" -eq 0 ] - history="$output" - run bash -c grep "importing container test message" <<< "$history" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} history imported-image" echo "$output" [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio + [[ "$output" == *"importing container test message"* ]] rm -f container.tar } @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" - [ "$status" -eq 0 ] - pod_id="$output" - run bash -c crioctl image pull "$IMAGE" - echo "$output" - [ "$status" -eq 0 ] - run bash -c crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} run -d $ALPINE sleep 60" echo "$output" [ "$status" -eq 0 ] ctr_id="$output" - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar "$ctr_id" - echo "$output" - [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} import --change "CMD=/bin/bash" container.tar imported-image + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} export -o container.tar $ctr_id" echo "$output" [ "$status" -eq 0 ] - run bash -c ${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect imported-image + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} import --change 'CMD=/bin/bash' container.tar imported-image" echo "$output" [ "$status" -eq 0 ] - inspect="$output" - run bash -c grep "/bin/bash" <<< "$inspect" + run bash -c "${PODMAN_BINARY} ${PODMAN_OPTIONS} inspect imported-image" echo "$output" [ "$status" -eq 0 ] - cleanup_ctrs - cleanup_pods - stop_crio + [[ "$output" == *"/bin/bash"* ]] rm -f container.tar } |