diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-09-22 10:54:23 +0200 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-09-25 10:57:30 -0400 |
commit | bc8ada648a748198ec0cae706f18398e6b91c803 (patch) | |
tree | 62620d713e43a5f1191789ce5ee95a166c5be4d4 /test/system | |
parent | 17db9851d05544ef49f8bce0deec452a99aae2a9 (diff) | |
download | podman-bc8ada648a748198ec0cae706f18398e6b91c803.tar.gz podman-bc8ada648a748198ec0cae706f18398e6b91c803.tar.bz2 podman-bc8ada648a748198ec0cae706f18398e6b91c803.zip |
podman save: fix redirect of multi-images
Fix a bug when saving multi-image archives where the progress bars from
copying images was accidentally written to the archive and hence
corrupted it.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/120-load.bats | 41 |
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 |