summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-19 16:22:05 -0400
committerGitHub <noreply@github.com>2021-04-19 16:22:05 -0400
commita94360a3f742cac07b006233371058d8b8c2caf3 (patch)
tree3dbbde6b5388f96f1552ca173bf49d0b49fa8e1a /test
parentb5e0b292bf4ebf98a1ad45681da5f297d86de44b (diff)
parent4ffaa50d05bcb08d7db242232a128bb3493fcf25 (diff)
downloadpodman-a94360a3f742cac07b006233371058d8b8c2caf3.tar.gz
podman-a94360a3f742cac07b006233371058d8b8c2caf3.tar.bz2
podman-a94360a3f742cac07b006233371058d8b8c2caf3.zip
Merge pull request #10041 from chenk008/add_pidfile_flag
Add flag "--pidfile" for podman create/run
Diffstat (limited to 'test')
-rw-r--r--test/e2e/inspect_test.go10
-rw-r--r--test/e2e/run_test.go16
-rw-r--r--test/e2e/start_test.go24
3 files changed, 50 insertions, 0 deletions
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index 772ebed05..ba018b5ad 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -508,4 +508,14 @@ var _ = Describe("Podman inspect", func() {
Expect(data[0].HostConfig.CapDrop[1]).To(Equal("CAP_MKNOD"))
Expect(data[0].HostConfig.CapDrop[2]).To(Equal("CAP_NET_RAW"))
})
+
+ It("podman inspect container with GO format for PidFile", func() {
+ SkipIfRemote("pidfile not handled by remote")
+ session, ec, _ := podmanTest.RunLsContainer("test1")
+ Expect(ec).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"inspect", "--format", "{{.PidFile}}", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index cefe00655..93505d742 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1613,4 +1613,20 @@ WORKDIR /madethis`, BB)
Expect(running.ExitCode()).To(Equal(0))
Expect(len(running.OutputToStringArray())).To(Equal(2))
})
+
+ It("podman run with pidfile", func() {
+ SkipIfRemote("pidfile not handled by remote")
+ pidfile := tempdir + "pidfile"
+ session := podmanTest.Podman([]string{"run", "--pidfile", pidfile, ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ readFirstLine := func(path string) string {
+ content, err := ioutil.ReadFile(path)
+ Expect(err).To(BeNil())
+ return strings.Split(string(content), "\n")[0]
+ }
+ containerPID := readFirstLine(pidfile)
+ _, err = strconv.Atoi(containerPID) // Make sure it's a proper integer
+ Expect(err).To(BeNil())
+ })
})
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index f527b67f6..cb2db0810 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -1,7 +1,10 @@
package integration
import (
+ "io/ioutil"
"os"
+ "strconv"
+ "strings"
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
@@ -206,4 +209,25 @@ var _ = Describe("Podman start", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
})
+
+ It("podman start container with special pidfile", func() {
+ SkipIfRemote("pidfile not handled by remote")
+ pidfile := tempdir + "pidfile"
+ session := podmanTest.Podman([]string{"create", "--pidfile", pidfile, ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"start", cid})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ readFirstLine := func(path string) string {
+ content, err := ioutil.ReadFile(path)
+ Expect(err).To(BeNil())
+ return strings.Split(string(content), "\n")[0]
+ }
+ containerPID := readFirstLine(pidfile)
+ _, err = strconv.Atoi(containerPID) // Make sure it's a proper integer
+ Expect(err).To(BeNil())
+ })
})