summaryrefslogtreecommitdiff
path: root/test/e2e/create_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/create_test.go')
-rw-r--r--test/e2e/create_test.go74
1 files changed, 62 insertions, 12 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 82346823a..0a6373bfa 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -18,7 +18,6 @@ var _ = Describe("Podman create", func() {
)
BeforeEach(func() {
- Skip(v2fail)
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -36,13 +35,13 @@ var _ = Describe("Podman create", func() {
})
It("podman create container based on a local image", func() {
- session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--name", "local_image_test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
cid := session.OutputToString()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
- check := podmanTest.Podman([]string{"inspect", "-l"})
+ check := podmanTest.Podman([]string{"inspect", "local_image_test"})
check.WaitWithDefaultTimeout()
data := check.InspectContainerToJSON()
Expect(data[0].ID).To(ContainSubstring(cid))
@@ -81,12 +80,12 @@ var _ = Describe("Podman create", func() {
})
It("podman create adds annotation", func() {
- session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD", ALPINE, "ls"})
+ session := podmanTest.Podman([]string{"create", "--annotation", "HELLO=WORLD", "--name", "annotate_test", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
- check := podmanTest.Podman([]string{"inspect", "-l"})
+ check := podmanTest.Podman([]string{"inspect", "annotate_test"})
check.WaitWithDefaultTimeout()
data := check.InspectContainerToJSON()
value, ok := data[0].Config.Annotations["HELLO"]
@@ -95,12 +94,12 @@ var _ = Describe("Podman create", func() {
})
It("podman create --entrypoint command", func() {
- session := podmanTest.Podman([]string{"create", "--entrypoint", "/bin/foobar", ALPINE})
+ session := podmanTest.Podman([]string{"create", "--name", "entrypoint_test", "--entrypoint", "/bin/foobar", ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
- result := podmanTest.Podman([]string{"inspect", "-l", "--format", "{{.Config.Entrypoint}}"})
+ result := podmanTest.Podman([]string{"inspect", "entrypoint_test", "--format", "{{.Config.Entrypoint}}"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(Equal("/bin/foobar"))
@@ -120,18 +119,19 @@ var _ = Describe("Podman create", func() {
It("podman create --entrypoint json", func() {
jsonString := `[ "/bin/foo", "-c"]`
- session := podmanTest.Podman([]string{"create", "--entrypoint", jsonString, ALPINE})
+ session := podmanTest.Podman([]string{"create", "--name", "entrypoint_json", "--entrypoint", jsonString, ALPINE})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
- result := podmanTest.Podman([]string{"inspect", "-l", "--format", "{{.Config.Entrypoint}}"})
+ result := podmanTest.Podman([]string{"inspect", "entrypoint_json", "--format", "{{.Config.Entrypoint}}"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(result.OutputToString()).To(Equal("/bin/foo -c"))
})
It("podman create --mount flag with multiple mounts", func() {
+ Skip(v2remotefail)
vol1 := filepath.Join(podmanTest.TempDir, "vol-test1")
err := os.MkdirAll(vol1, 0755)
Expect(err).To(BeNil())
@@ -157,6 +157,7 @@ var _ = Describe("Podman create", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("skip failing test on ppc64le")
}
+ Skip(v2remotefail)
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
os.Mkdir(mountPath, 0755)
session := podmanTest.Podman([]string{"create", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
@@ -206,7 +207,7 @@ var _ = Describe("Podman create", func() {
session = podmanTest.Podman([]string{"logs", "test_tmpfs"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(session.OutputToString()).To(ContainSubstring("/create/test rw,nosuid,nodev,noexec,relatime - tmpfs"))
+ Expect(session.OutputToString()).To(ContainSubstring("/create/test rw,nosuid,nodev,relatime - tmpfs"))
})
It("podman create --pod automatically", func() {
@@ -234,11 +235,11 @@ var _ = Describe("Podman create", func() {
})
It("podman create --pull", func() {
- session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "nginx"})
+ session := podmanTest.PodmanNoCache([]string{"create", "--pull", "never", "--name=foo", "debian"})
session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError())
- session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "nginx"})
+ session = podmanTest.PodmanNoCache([]string{"create", "--pull", "always", "--name=foo", "debian"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
@@ -343,4 +344,53 @@ var _ = Describe("Podman create", func() {
Expect(ok2).To(BeTrue())
Expect(val2).To(Equal("bar"))
})
+
+ It("podman create with --restart=on-failure:5 parses correctly", func() {
+ ctrName := "testctr"
+ session := podmanTest.Podman([]string{"create", "-t", "--restart", "on-failure:5", "--name", ctrName, ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName})
+ inspect.WaitWithDefaultTimeout()
+ data := inspect.InspectContainerToJSON()
+ Expect(len(data)).To(Equal(1))
+ Expect(data[0].HostConfig.RestartPolicy.Name).To(Equal("on-failure"))
+ Expect(data[0].HostConfig.RestartPolicy.MaximumRetryCount).To(Equal(uint(5)))
+ })
+
+ It("podman create with --restart-policy=always:5 fails", func() {
+ session := podmanTest.Podman([]string{"create", "-t", "--restart", "always:5", ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
+
+ It("podman create with -m 1000000 sets swap to 2000000", func() {
+ numMem := 1000000
+ ctrName := "testCtr"
+ session := podmanTest.Podman([]string{"create", "-t", "-m", fmt.Sprintf("%db", numMem), "--name", ctrName, ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName})
+ inspect.WaitWithDefaultTimeout()
+ data := inspect.InspectContainerToJSON()
+ Expect(len(data)).To(Equal(1))
+ Expect(data[0].HostConfig.MemorySwap).To(Equal(int64(2 * numMem)))
+ })
+
+ It("podman create --cpus 5 sets nanocpus", func() {
+ numCpus := 5
+ nanoCPUs := numCpus * 1000000000
+ ctrName := "testCtr"
+ session := podmanTest.Podman([]string{"create", "-t", "--cpus", fmt.Sprintf("%d", numCpus), "--name", ctrName, ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName})
+ inspect.WaitWithDefaultTimeout()
+ data := inspect.InspectContainerToJSON()
+ Expect(len(data)).To(Equal(1))
+ Expect(data[0].HostConfig.NanoCpus).To(Equal(int64(nanoCPUs)))
+ })
})