summaryrefslogtreecommitdiff
path: root/test/e2e/create_test.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-05-29 10:35:22 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-06-11 11:01:13 +0200
commitcf89bb671184e453c4ba5f27e26d02216d8fc491 (patch)
treeed707e35dcae297a60e97150bc407d9a5ea5ff80 /test/e2e/create_test.go
parent7d71d24440afbf30689c53c2c69205072e4b029f (diff)
downloadpodman-cf89bb671184e453c4ba5f27e26d02216d8fc491.tar.gz
podman-cf89bb671184e453c4ba5f27e26d02216d8fc491.tar.bz2
podman-cf89bb671184e453c4ba5f27e26d02216d8fc491.zip
container-{create,run}: add `--pod-id-file`
Allow containers to join an existing pod via the `--pod-id-file` which is already supported by a number of `podman-pod` subcommands. Also add tests to make sure it's working and to prevent future regressions. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'test/e2e/create_test.go')
-rw-r--r--test/e2e/create_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index f40472a7c..b9a1ff83d 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})