diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/pause_test.go | 5 | ||||
-rw-r--r-- | test/system/075-exec.bats | 28 | ||||
-rw-r--r-- | test/system/125-import.bats | 63 |
3 files changed, 96 insertions, 0 deletions
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index ea7a96428..2e5e07de9 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -79,6 +79,11 @@ var _ = Describe("Podman pause", func() { Expect(result).To(ExitWithError()) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(createdState)) + + // check we can read stats for a paused container + result = podmanTest.Podman([]string{"stats", "--no-stream", cid}) + result.WaitWithDefaultTimeout() + Expect(result).To(ExitWithError()) }) It("podman pause a running container by id", func() { diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats index 3e8c3c1ea..b7367d153 100644 --- a/test/system/075-exec.bats +++ b/test/system/075-exec.bats @@ -101,4 +101,32 @@ load helpers run_podman rm $cid } +# #11496: podman-remote loses output +@test "podman exec/run - missing output" { + local bigfile=${PODMAN_TMPDIR}/bigfile + local newfile=${PODMAN_TMPDIR}/newfile + # create a big file, bigger than the 8K buffer size + base64 /dev/urandom | head -c 20K > $bigfile + + run_podman run --rm -v $bigfile:/tmp/test:Z $IMAGE cat /tmp/test + printf "%s" "$output" > $newfile + # use cmp to compare the files, this is very helpful since it will + # tell us the first wrong byte in case this fails + run cmp $bigfile $newfile + is "$output" "" "run output is identical with the file" + + run_podman run -d --stop-timeout 0 -v $bigfile:/tmp/test:Z $IMAGE sleep inf + cid="$output" + + run_podman exec $cid cat /tmp/test + printf "%s" "$output" > $newfile + # use cmp to compare the files, this is very helpful since it will + # tell us the first wrong byte in case this fails + run cmp $bigfile $newfile + is "$output" "" "exec output is identical with the file" + + # Clean up + run_podman rm -f $cid +} + # vim: filetype=sh diff --git a/test/system/125-import.bats b/test/system/125-import.bats index c53711618..5995d71bf 100644 --- a/test/system/125-import.bats +++ b/test/system/125-import.bats @@ -43,3 +43,66 @@ load helpers is "$output" "$random_content" "tagged import via stdin" run_podman rmi -f $fqin } + +@test "podman export, alter tarball, re-import" { + + # Create a test file following test + mkdir $PODMAN_TMPDIR/tmp + touch $PODMAN_TMPDIR/testfile1 + echo "modified tar file" >> $PODMAN_TMPDIR/tmp/testfile2 + + # Create Dockerfile for test + dockerfile=$PODMAN_TMPDIR/Dockerfile + + cat >$dockerfile <<EOF +FROM $IMAGE +ADD testfile1 /tmp +WORKDIR /tmp +EOF + + b_img=before_change_img + b_cnt=before_change_cnt + a_img=after_change_img + a_cnt=after_change_cnt + + # Build from Dockerfile FROM non-existing local image + run_podman build -t $b_img $PODMAN_TMPDIR + run_podman create --name $b_cnt $b_img + + # Export built container as tarball + run_podman export -o $PODMAN_TMPDIR/$b_cnt.tar $b_cnt + run_podman rm -f $b_cnt + + # Modify tarball contents + tar --delete -f $PODMAN_TMPDIR/$b_cnt.tar tmp/testfile1 + tar -C $PODMAN_TMPDIR -rf $PODMAN_TMPDIR/$b_cnt.tar tmp/testfile2 + + # Import tarball and Tag imported image + run_podman import -q $PODMAN_TMPDIR/$b_cnt.tar \ + --change "CMD sh -c \ + \"trap 'exit 33' 2; + while true; do sleep 0.05;done\"" $a_img + + # Run imported image to confirm tarball modification, block on non-special signal + run_podman run --name $a_cnt -d $a_img + + # Confirm testfile1 is deleted from tarball + run_podman 1 exec $a_cnt cat /tmp/testfile1 + is "$output" ".*can't open '/tmp/testfile1': No such file or directory" + + # Confirm testfile2 is added to tarball + run_podman exec $a_cnt cat /tmp/testfile2 + is "$output" "modified tar file" "modify tarball content" + + # Kill can send non-TERM/KILL signal to container to exit + run_podman kill --signal 2 $a_cnt + run_podman wait $a_cnt + + # Confirm exit within timeout + run_podman ps -a --filter name=$a_cnt --format '{{.Status}}' + is "$output" "Exited (33)" "Exit by non-TERM/KILL" + + run_podman rm -f $a_cnt + run_podman rmi $b_img $a_img + +} |