aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-21 19:27:19 +0200
committerGitHub <noreply@github.com>2020-05-21 19:27:19 +0200
commit17553caca453b3ca24ad3e5f1c15ffeaad87030a (patch)
tree2d9f2f1963240fa230768469aea1865f8e4b9f3c /test
parent6c8ce3eff60d0e220d3ca04706d9d05b3887b5ed (diff)
parent9415670722373d1c374da3587ce953b3d99f8961 (diff)
downloadpodman-17553caca453b3ca24ad3e5f1c15ffeaad87030a.tar.gz
podman-17553caca453b3ca24ad3e5f1c15ffeaad87030a.tar.bz2
podman-17553caca453b3ca24ad3e5f1c15ffeaad87030a.zip
Merge pull request #6313 from sujil02/pod-create-id
Fixes podman pod create --pod-id-file #6292
Diffstat (limited to 'test')
-rw-r--r--test/e2e/pod_create_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 24bfa69ce..e56db54a2 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -2,7 +2,9 @@ package integration
import (
"fmt"
+ "io/ioutil"
"os"
+ "path/filepath"
"strings"
. "github.com/containers/libpod/test/utils"
@@ -282,4 +284,26 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout()
Expect(podCreate.ExitCode()).To(Equal(125))
})
+
+ It("podman create pod 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())
+
+ session := podmanTest.Podman([]string{"pod", "create", "--name=abc", "--pod-id-file", targetFile})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ id, _ := ioutil.ReadFile(targetFile)
+ check := podmanTest.Podman([]string{"pod", "inspect", "abc"})
+ check.WaitWithDefaultTimeout()
+ data := check.InspectPodToJSON()
+ Expect(data.ID).To(Equal(string(id)))
+ })
})