summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/build_test.go23
-rw-r--r--test/e2e/commit_test.go28
2 files changed, 51 insertions, 0 deletions
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 240ef1627..8b03e9386 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -152,4 +152,27 @@ var _ = Describe("Podman build", func() {
Expect(strings.Fields(session.OutputToString())).
To(ContainElement("scratch"))
})
+
+ It("podman build basic alpine and print id to external file", func() {
+
+ // Switch to temp dir and restore it afterwards
+ cwd, err := os.Getwd()
+ Expect(err).To(BeNil())
+ Expect(os.Chdir(os.TempDir())).To(BeNil())
+ defer Expect(os.Chdir(cwd)).To(BeNil())
+
+ targetPath := filepath.Join(os.TempDir(), "dir")
+ targetFile := filepath.Join(targetPath, "idFile")
+
+ session := podmanTest.PodmanNoCache([]string{"build", "build/basicalpine", "--iidfile", targetFile})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ id, _ := ioutil.ReadFile(targetFile)
+
+ // Verify that id is correct
+ inspect := podmanTest.PodmanNoCache([]string{"inspect", string(id)})
+ inspect.WaitWithDefaultTimeout()
+ data := inspect.InspectImageJSON()
+ Expect(data[0].ID).To(Equal(string(id)))
+ })
})
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index d4503d5a8..72387ed8c 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -1,7 +1,9 @@
package integration
import (
+ "io/ioutil"
"os"
+ "path/filepath"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -234,4 +236,30 @@ var _ = Describe("Podman commit", func() {
}
Expect(envMap["TEST=1=1-01=9.01"]).To(BeTrue())
})
+
+ It("podman commit container and print id to external file", func() {
+ // Switch to temp dir and restore it afterwards
+ cwd, err := os.Getwd()
+ Expect(err).To(BeNil())
+ Expect(os.Chdir(os.TempDir())).To(BeNil())
+ targetPath := filepath.Join(os.TempDir(), "dir")
+ Expect(os.MkdirAll(targetPath, 0755)).To(BeNil())
+ targetFile := filepath.Join(targetPath, "idFile")
+ defer Expect(os.RemoveAll(targetFile)).To(BeNil())
+ defer Expect(os.Chdir(cwd)).To(BeNil())
+
+ _, ec, _ := podmanTest.RunLsContainer("test1")
+ Expect(ec).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(1))
+
+ session := podmanTest.Podman([]string{"commit", "test1", "foobar.com/test1-image:latest", "--iidfile", targetFile})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ id, _ := ioutil.ReadFile(targetFile)
+ check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
+ check.WaitWithDefaultTimeout()
+ data := check.InspectImageJSON()
+ Expect(data[0].ID).To(Equal(string(id)))
+ })
})