From f2658ecda25cbc83d09256d9e8f99560433d2595 Mon Sep 17 00:00:00 2001 From: Yiqiao Pu Date: Thu, 19 Apr 2018 17:45:00 +0800 Subject: Add one test case for check diff in container and committed image The test steps are: 1. Start a container and touch a file under /tmp 2. Use diff to check the container 3. commit the change into a new image 4. Use diff to check the image Signed-off-by: Yiqiao Pu Closes: #643 Approved by: mheon --- test/e2e/diff_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go index eca485c8b..319f086cd 100644 --- a/test/e2e/diff_test.go +++ b/test/e2e/diff_test.go @@ -2,6 +2,7 @@ package integration import ( "os" + "sort" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -47,4 +48,24 @@ var _ = Describe("Podman diff", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.IsJSONOutputValid()).To(BeTrue()) }) + + It("podman diff container and committed image", func() { + session := podmanTest.Podman([]string{"run", "--name=diff-test", ALPINE, "touch", "/tmp/diff-test"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"diff", "diff-test"}) + session.WaitWithDefaultTimeout() + containerDiff := session.OutputToStringArray() + sort.Strings(containerDiff) + Expect(session.LineInOutputContains("C /tmp")).To(BeTrue()) + Expect(session.LineInOutputContains("A /tmp/diff-test")).To(BeTrue()) + session = podmanTest.Podman([]string{"commit", "diff-test", "diff-test-img"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"diff", "diff-test-img"}) + session.WaitWithDefaultTimeout() + imageDiff := session.OutputToStringArray() + sort.Strings(imageDiff) + Expect(imageDiff).To(Equal(containerDiff)) + }) }) -- cgit v1.2.3-54-g00ecf