summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiqiao Pu <ypu@redhat.com>2018-04-19 17:45:00 +0800
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-19 14:19:04 +0000
commitf2658ecda25cbc83d09256d9e8f99560433d2595 (patch)
tree7654f597c91148ff2df457b411bb83ac7940f4eb
parent27107fdac1d75f97caab47cd13efb1d9900cf350 (diff)
downloadpodman-f2658ecda25cbc83d09256d9e8f99560433d2595.tar.gz
podman-f2658ecda25cbc83d09256d9e8f99560433d2595.tar.bz2
podman-f2658ecda25cbc83d09256d9e8f99560433d2595.zip
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 <ypu@redhat.com> Closes: #643 Approved by: mheon
-rw-r--r--test/e2e/diff_test.go21
1 files changed, 21 insertions, 0 deletions
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))
+ })
})