summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-22 17:40:16 +0000
committerGitHub <noreply@github.com>2020-09-22 17:40:16 +0000
commitfac9252205c089b3bc409a4592e0635a780efaba (patch)
treeb8c0f646f4d72928a0309b23910aa5a6ecb99e74 /test
parent4e4c9056e0c044b95bfd808a5afd0fd64f4fa9fc (diff)
parent78afe67e00a78b98483a9bb1cb55f58dffc4c001 (diff)
downloadpodman-fac9252205c089b3bc409a4592e0635a780efaba.tar.gz
podman-fac9252205c089b3bc409a4592e0635a780efaba.tar.bz2
podman-fac9252205c089b3bc409a4592e0635a780efaba.zip
Merge pull request #7719 from vrothberg/fix-multi-image-save
podman save: fix redirect of multi-images
Diffstat (limited to 'test')
-rw-r--r--test/system/120-load.bats41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index d7aa16d95..8ea9b1c69 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -147,4 +147,45 @@ verify_iid_and_name() {
"Diagnostic from 'podman load' without redirection or -i"
}
+@test "podman load - multi-image archive" {
+ img1="quay.io/libpod/testimage:00000000"
+ img2="quay.io/libpod/testimage:20200902"
+ archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
+
+ run_podman pull $img1
+ run_podman pull $img2
+
+ run_podman save -m -o $archive $img1 $img2
+ run_podman rmi -f $img1 $img2
+ run_podman load -i $archive
+
+ run_podman image exists $img1
+ run_podman image exists $img2
+ run_podman rmi -f $img1 $img2
+}
+
+@test "podman load - multi-image archive with redirect" {
+ img1="quay.io/libpod/testimage:00000000"
+ img2="quay.io/libpod/testimage:20200902"
+ archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
+
+ run_podman pull $img1
+ run_podman pull $img2
+
+ # We can't use run_podman because that uses the BATS 'run' function
+ # which redirects stdout and stderr. Here we need to guarantee
+ # that podman's stdout is a pipe, not any other form of redirection
+ $PODMAN save -m $img1 $img2 | cat >$archive
+ if [ "$status" -ne 0 ]; then
+ die "Command failed: podman save ... | cat"
+ fi
+
+ run_podman rmi -f $img1 $img2
+ run_podman load -i $archive
+
+ run_podman image exists $img1
+ run_podman image exists $img2
+ run_podman rmi -f $img1 $img2
+}
+
# vim: filetype=sh