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.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index f40472a7c..822e470f2 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -2,6 +2,7 @@ package integration
import (
"fmt"
+ "io/ioutil"
"os"
"path/filepath"
@@ -221,6 +222,42 @@ var _ = Describe("Podman create", func() {
Expect(match).To(BeTrue())
})
+ It("podman create --pod-id-file", func() {
+ // First, make sure that --pod and --pod-id-file yield an error
+ // if used together.
+ session := podmanTest.Podman([]string{"create", "--pod", "foo", "--pod-id-file", "bar", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+
+ tmpDir, err := ioutil.TempDir("", "")
+ Expect(err).To(BeNil())
+ defer os.RemoveAll(tmpDir)
+
+ podName := "rudoplh"
+ ctrName := "prancer"
+ podIDFile := tmpDir + "pod-id-file"
+
+ // Now, let's create a pod with --pod-id-file.
+ session = podmanTest.Podman([]string{"pod", "create", "--pod-id-file", podIDFile, "--name", podName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"pod", "inspect", podName})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.IsJSONOutputValid()).To(BeTrue())
+ podData := session.InspectPodToJSON()
+
+ // Finally we can create a container with --pod-id-file and do
+ // some checks to make sure it's working as expected.
+ session = podmanTest.Podman([]string{"create", "--pod-id-file", podIDFile, "--name", ctrName, ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ ctrJSON := podmanTest.InspectContainer(ctrName)
+ Expect(podData.ID).To(Equal(ctrJSON[0].Pod)) // Make sure the container's pod matches the pod's ID
+ })
+
It("podman run entrypoint and cmd test", func() {
name := "test101"
create := podmanTest.Podman([]string{"create", "--name", name, redis})
@@ -392,4 +429,19 @@ var _ = Describe("Podman create", func() {
Expect(len(data)).To(Equal(1))
Expect(data[0].HostConfig.NanoCpus).To(Equal(int64(nanoCPUs)))
})
+
+ It("podman create --replace", func() {
+ // Make sure we error out with --name.
+ session := podmanTest.Podman([]string{"create", "--replace", ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+
+ // Create and replace 5 times in a row the "same" container.
+ ctrName := "testCtr"
+ for i := 0; i < 5; i++ {
+ session = podmanTest.Podman([]string{"create", "--replace", "--name", ctrName, ALPINE, "/bin/sh"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ }
+ })
})