diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/e2e.coverprofile | 11 | ||||
-rw-r--r-- | test/e2e/import_test.go | 8 | ||||
-rw-r--r-- | test/system/070-build.bats | 48 |
3 files changed, 54 insertions, 13 deletions
diff --git a/test/e2e/e2e.coverprofile b/test/e2e/e2e.coverprofile deleted file mode 100644 index d413679ea..000000000 --- a/test/e2e/e2e.coverprofile +++ /dev/null @@ -1,11 +0,0 @@ -mode: atomic -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:14.46,21.20 2 3 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:32.2,32.19 1 3 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:39.2,39.53 1 3 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:66.2,66.52 1 3 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:21.20,23.17 2 6 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:26.3,29.36 4 6 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:23.17,25.4 1 0 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:32.19,37.3 3 6 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:39.53,64.3 20 3 -github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:66.52,91.3 20 3
\ No newline at end of file diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go index 979440a50..bceb30f7c 100644 --- a/test/e2e/import_test.go +++ b/test/e2e/import_test.go @@ -105,7 +105,9 @@ var _ = Describe("Podman import", func() { results.WaitWithDefaultTimeout() Expect(results.ExitCode()).To(Equal(0)) imageData := results.InspectImageJSON() - Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/bash")) + Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/sh")) + Expect(imageData[0].Config.Cmd[1]).To(Equal("-c")) + Expect(imageData[0].Config.Cmd[2]).To(Equal("/bin/bash")) }) It("podman import with change flag CMD <path>", func() { @@ -126,6 +128,8 @@ var _ = Describe("Podman import", func() { Expect(results.ExitCode()).To(Equal(0)) imageData := results.InspectImageJSON() Expect(imageData[0].Config.Cmd[0]).To(Equal("/bin/sh")) + Expect(imageData[0].Config.Cmd[1]).To(Equal("-c")) + Expect(imageData[0].Config.Cmd[2]).To(Equal("/bin/sh")) }) It("podman import with change flag CMD [\"path\",\"path'\"", func() { @@ -137,7 +141,7 @@ var _ = Describe("Podman import", func() { export.WaitWithDefaultTimeout() Expect(export.ExitCode()).To(Equal(0)) - importImage := podmanTest.Podman([]string{"import", "--change", "CMD [/bin/bash]", outfile, "imported-image"}) + importImage := podmanTest.Podman([]string{"import", "--change", "CMD [\"/bin/bash\"]", outfile, "imported-image"}) importImage.WaitWithDefaultTimeout() Expect(importImage.ExitCode()).To(Equal(0)) diff --git a/test/system/070-build.bats b/test/system/070-build.bats index a9d2ed1b7..7c39da72c 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -32,6 +32,54 @@ EOF run_podman rmi -f build_test } +# Regression from v1.5.0. This test passes fine in v1.5.0, fails in 1.6 +@test "podman build - cache (#3920)" { + if is_remote && is_rootless; then + skip "unreliable with podman-remote and rootless; #2972" + fi + + # Make an empty test directory, with a subdirectory used for tar + tmpdir=$PODMAN_TMPDIR/build-test + run mkdir -p $tmpdir/subtest || die "Could not mkdir $tmpdir/subtest" + + echo "This is the ORIGINAL file" > $tmpdir/subtest/myfile1 + run tar -C $tmpdir -cJf $tmpdir/myfile.tar.xz subtest + + cat >$tmpdir/Dockerfile <<EOF +FROM $IMAGE +ADD myfile.tar.xz / +EOF + + # One of: ADD myfile /myfile or COPY . . + run_podman build -t build_test -f $tmpdir/Dockerfile $tmpdir + is "$output" ".*STEP 3: COMMIT" "COMMIT seen in log" + if [[ "$output" =~ "Using cache" ]]; then + is "$output" "[no instance of 'Using cache']" "no cache used" + fi + iid=${lines[-1]} + + run_podman run --rm build_test cat /subtest/myfile1 + is "$output" "This is the ORIGINAL file" "file contents, first time" + + # Step 2: Recreate the tarfile, with new content. Rerun podman build. + echo "This is a NEW file" >| $tmpdir/subtest/myfile2 + run tar -C $tmpdir -cJf $tmpdir/myfile.tar.xz subtest + + run_podman build -t build_test -f $tmpdir/Dockerfile $tmpdir + is "$output" ".*STEP 3: COMMIT" "COMMIT seen in log" + + # Since the tarfile is modified, podman SHOULD NOT use a cached layer. + if [[ "$output" =~ "Using cache" ]]; then + is "$output" "[no instance of 'Using cache']" "no cache used" + fi + + # Pre-buildah-1906, this fails with ENOENT because the tarfile was cached + run_podman run --rm build_test cat /subtest/myfile2 + is "$output" "This is a NEW file" "file contents, second time" + + run_podman rmi -f build_test $iid +} + function teardown() { # A timeout or other error in 'build' can leave behind stale images # that podman can't even see and which will cascade into subsequent |