aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-01-23 21:07:37 -0500
committerGitHub <noreply@github.com>2018-01-23 21:07:37 -0500
commitdd4e6920c2f418b479e1cadd74ab4d5d6985cf04 (patch)
tree089727a38022883951dd746ea3f972f5e806a07a /test
parenta03e040f0bb1d32645879b2c8bec7c5e1fe0561f (diff)
parentcae415b91cf81416ad7d89f9b3ba16a26ae28fc5 (diff)
downloadpodman-dd4e6920c2f418b479e1cadd74ab4d5d6985cf04.tar.gz
podman-dd4e6920c2f418b479e1cadd74ab4d5d6985cf04.tar.bz2
podman-dd4e6920c2f418b479e1cadd74ab4d5d6985cf04.zip
Merge pull request #224 from ypu/import_test
Update podman_import test to use podman
Diffstat (limited to 'test')
-rw-r--r--test/podman_import.bats102
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
}