diff options
author | chenkang <kongchen28@gmail.com> | 2021-04-17 20:42:21 +0800 |
---|---|---|
committer | chenkang <kongchen28@gmail.com> | 2021-04-17 20:42:21 +0800 |
commit | f3f7ae5cddada6a1faa4bef21c586efb83c70c19 (patch) | |
tree | 8aab2541e6a7545df25b9d4e7739b1215e1be833 /test | |
parent | c9f347e9a8c013348d236bc205b3eca13d3f29ef (diff) | |
download | podman-f3f7ae5cddada6a1faa4bef21c586efb83c70c19.tar.gz podman-f3f7ae5cddada6a1faa4bef21c586efb83c70c19.tar.bz2 podman-f3f7ae5cddada6a1faa4bef21c586efb83c70c19.zip |
add pidfile it for container start
Signed-off-by: chenkang <kongchen28@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/start_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index f527b67f6..be724ab35 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,23 @@ var _ = Describe("Podman start", func() { session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) }) + + It("podman start container with special pidfile", func() { + 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}) + 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()) + }) }) |