mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
add pidfile it for container start
Signed-off-by: chenkang <kongchen28@gmail.com>
This commit is contained in:
@ -1,7 +1,10 @@
|
|||||||
package integration
|
package integration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
. "github.com/containers/podman/v3/test/utils"
|
. "github.com/containers/podman/v3/test/utils"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -206,4 +209,23 @@ var _ = Describe("Podman start", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(125))
|
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())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user