summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-02-22 22:10:34 +0530
committerAditya R <arajan@redhat.com>2022-02-23 17:38:28 +0530
commitfbbcb957c710ab817c969a8dc3ff3c46619604e2 (patch)
tree33971ff9377ee3cbf455ebe4c915722d3c3438bc /test/e2e
parent0cfb5d7e75507783e463e0df645e873e5a77bbfa (diff)
downloadpodman-fbbcb957c710ab817c969a8dc3ff3c46619604e2.tar.gz
podman-fbbcb957c710ab817c969a8dc3ff3c46619604e2.tar.bz2
podman-fbbcb957c710ab817c969a8dc3ff3c46619604e2.zip
container-commit: support --squash to squash layers into one
Allow users to commit containers into a single layer. Usage ```bash podman container commit --squash <name> ``` Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/commit_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index 495e31520..6bcf17bfe 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "strings"
. "github.com/containers/podman/v4/test/utils"
. "github.com/onsi/ginkgo"
@@ -133,6 +134,23 @@ var _ = Describe("Podman commit", func() {
Expect(foundBlue).To(Equal(true))
})
+ It("podman commit container with --squash", func() {
+ test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
+ test.WaitWithDefaultTimeout()
+ Expect(test).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(1))
+
+ session := podmanTest.Podman([]string{"commit", "--squash", "test1", "foobar.com/test1-image:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "foobar.com/test1-image:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ // Check for one layers
+ Expect(strings.Fields(session.OutputToString())).To(HaveLen(1))
+ })
+
It("podman commit container with change flag and JSON entrypoint with =", func() {
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
test.WaitWithDefaultTimeout()