mirror of
https://github.com/containers/podman.git
synced 2025-07-01 00:01:02 +08:00
e2e tests: stop littering
"tmpdir + string" does not do what you think it does. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -228,11 +228,9 @@ var _ = Describe("Podman create", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitWithError(125, "cannot specify both --pod and --pod-id-file"))
|
||||
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
|
||||
podName := "rudolph"
|
||||
ctrName := "prancer"
|
||||
podIDFile := tmpDir + "pod-id-file"
|
||||
podIDFile := filepath.Join(tempdir, "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})
|
||||
|
@ -2,6 +2,7 @@ package integration
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
@ -537,8 +538,7 @@ var _ = Describe("Podman generate systemd", func() {
|
||||
})
|
||||
|
||||
It("podman generate systemd pod with containers --new", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "podID"
|
||||
tmpFile := filepath.Join(tempdir, "podID")
|
||||
|
||||
n := podmanTest.Podman([]string{"pod", "create", "--pod-id-file", tmpFile, "--name", "foo"})
|
||||
n.WaitWithDefaultTimeout()
|
||||
|
@ -1,6 +1,8 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
@ -126,15 +128,14 @@ var _ = Describe("Podman kill", func() {
|
||||
})
|
||||
|
||||
It("podman kill --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "cid"
|
||||
cidFile := filepath.Join(tempdir, "cid")
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile, ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", cidFile, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToStringArray()[0]
|
||||
|
||||
kill := podmanTest.Podman([]string{"kill", "--cidfile", tmpFile})
|
||||
kill := podmanTest.Podman([]string{"kill", "--cidfile", cidFile})
|
||||
kill.WaitWithDefaultTimeout()
|
||||
Expect(kill).Should(ExitCleanly())
|
||||
|
||||
@ -144,23 +145,20 @@ var _ = Describe("Podman kill", func() {
|
||||
})
|
||||
|
||||
It("podman kill multiple --cidfile", func() {
|
||||
tmpDir1 := GinkgoT().TempDir()
|
||||
tmpFile1 := tmpDir1 + "cid"
|
||||
cidFile1 := filepath.Join(tempdir, "cid1")
|
||||
cidFile2 := filepath.Join(tempdir, "cid2")
|
||||
|
||||
tmpDir2 := GinkgoT().TempDir()
|
||||
tmpFile2 := tmpDir2 + "cid"
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile1, ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"run", "-dt", "--cidfile", cidFile1, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid1 := session.OutputToStringArray()[0]
|
||||
|
||||
session2 := podmanTest.Podman([]string{"run", "-dt", "--cidfile", tmpFile2, ALPINE, "top"})
|
||||
session2 := podmanTest.Podman([]string{"run", "-dt", "--cidfile", cidFile2, ALPINE, "top"})
|
||||
session2.WaitWithDefaultTimeout()
|
||||
Expect(session2).Should(ExitCleanly())
|
||||
cid2 := session2.OutputToStringArray()[0]
|
||||
|
||||
kill := podmanTest.Podman([]string{"kill", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
kill := podmanTest.Podman([]string{"kill", "--cidfile", cidFile1, "--cidfile", cidFile2})
|
||||
kill.WaitWithDefaultTimeout()
|
||||
Expect(kill).Should(ExitCleanly())
|
||||
|
||||
|
@ -321,10 +321,9 @@ var _ = Describe("Podman pause", func() {
|
||||
})
|
||||
|
||||
It("podman pause --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "cid"
|
||||
cidFile := filepath.Join(tempdir, "cid")
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", cidFile, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToStringArray()[0]
|
||||
@ -333,13 +332,13 @@ var _ = Describe("Podman pause", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", "--cidfile", tmpFile})
|
||||
result := podmanTest.Podman([]string{"pause", "--cidfile", cidFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
Expect(output).To(ContainSubstring(cid))
|
||||
|
||||
result = podmanTest.Podman([]string{"unpause", "--cidfile", tmpFile})
|
||||
result = podmanTest.Podman([]string{"unpause", "--cidfile", cidFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output = result.OutputToString()
|
||||
@ -347,25 +346,22 @@ var _ = Describe("Podman pause", func() {
|
||||
})
|
||||
|
||||
It("podman pause multiple --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
cidFile1 := filepath.Join(tempdir, "cid-1")
|
||||
cidFile2 := filepath.Join(tempdir, "cid-2")
|
||||
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", tmpFile1, "-d", ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", cidFile1, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid1 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", tmpFile2, "-d", ALPINE, "top"})
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", cidFile2, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid2 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
||||
|
||||
result := podmanTest.Podman([]string{"pause", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result := podmanTest.Podman([]string{"pause", "--cidfile", cidFile1, "--cidfile", cidFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
@ -373,7 +369,7 @@ var _ = Describe("Podman pause", func() {
|
||||
Expect(output).To(ContainSubstring(cid2))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
||||
|
||||
result = podmanTest.Podman([]string{"unpause", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result = podmanTest.Podman([]string{"unpause", "--cidfile", cidFile1, "--cidfile", cidFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output = result.OutputToString()
|
||||
|
@ -3624,7 +3624,7 @@ VOLUME %s`, CITEST_IMAGE, hostPathDir+"/")
|
||||
kube.WaitWithDefaultTimeout()
|
||||
Expect(kube).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ls", hostPathDir + "/" + testfile})
|
||||
result := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ls", filepath.Join(hostPathDir, testfile)})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
|
||||
|
@ -215,13 +215,12 @@ var _ = Describe("Podman pod rm", func() {
|
||||
})
|
||||
|
||||
It("podman pod start/remove single pod via --pod-id-file", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "podID"
|
||||
podIDFile := filepath.Join(tempdir, "podID")
|
||||
|
||||
podName := "rudolph"
|
||||
|
||||
// Create a pod with --pod-id-file.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -230,26 +229,24 @@ var _ = Describe("Podman pod rm", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
|
||||
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
|
||||
|
||||
session = podmanTest.Podman([]string{"pod", "rm", "-t", "0", "--pod-id-file", tmpFile, "--force"})
|
||||
session = podmanTest.Podman([]string{"pod", "rm", "-t", "0", "--pod-id-file", podIDFile, "--force"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman pod start/remove multiple pods via --pod-id-file", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
|
||||
podIDFiles := []string{}
|
||||
for _, i := range "0123456789" {
|
||||
tmpFile := tmpDir + "cid" + string(i)
|
||||
cidFile := filepath.Join(tempdir, "cid"+string(i))
|
||||
podName := "rudolph" + string(i)
|
||||
// Create a pod with --pod-id-file.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", cidFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -260,7 +257,7 @@ var _ = Describe("Podman pod rm", func() {
|
||||
|
||||
// Append the id files along with the command.
|
||||
podIDFiles = append(podIDFiles, "--pod-id-file")
|
||||
podIDFiles = append(podIDFiles, tmpFile)
|
||||
podIDFiles = append(podIDFiles, cidFile)
|
||||
}
|
||||
|
||||
cmd := []string{"pod", "start"}
|
||||
|
@ -3,6 +3,7 @@ package integration
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -153,13 +154,12 @@ var _ = Describe("Podman pod start", func() {
|
||||
})
|
||||
|
||||
It("podman pod start single pod via --pod-id-file", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "podID"
|
||||
podIDFile := filepath.Join(tempdir, "podID")
|
||||
|
||||
podName := "rudolph"
|
||||
|
||||
// Create a pod with --pod-id-file.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -168,21 +168,19 @@ var _ = Describe("Podman pod start", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
|
||||
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
|
||||
})
|
||||
|
||||
It("podman pod start multiple pods via --pod-id-file", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
|
||||
podIDFiles := []string{}
|
||||
for _, i := range "0123456789" {
|
||||
tmpFile := tmpDir + "cid" + string(i)
|
||||
cidFile := filepath.Join(tempdir, "cid"+string(i))
|
||||
podName := "rudolph" + string(i)
|
||||
// Create a pod with --pod-id-file.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", cidFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -193,7 +191,7 @@ var _ = Describe("Podman pod start", func() {
|
||||
|
||||
// Append the id files along with the command.
|
||||
podIDFiles = append(podIDFiles, "--pod-id-file")
|
||||
podIDFiles = append(podIDFiles, tmpFile)
|
||||
podIDFiles = append(podIDFiles, cidFile)
|
||||
}
|
||||
|
||||
cmd := []string{"pod", "start"}
|
||||
@ -205,12 +203,11 @@ var _ = Describe("Podman pod start", func() {
|
||||
})
|
||||
|
||||
It("podman pod create --infra-conmon-pod create + start", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "podID"
|
||||
pidFile := filepath.Join(tempdir, "podID")
|
||||
|
||||
podName := "rudolph"
|
||||
// Create a pod with --infra-conmon-pid.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--infra-conmon-pidfile", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--infra-conmon-pidfile", pidFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -227,7 +224,7 @@ var _ = Describe("Podman pod start", func() {
|
||||
|
||||
// Read the infra-conmon-pidfile and perform some sanity checks
|
||||
// on the pid.
|
||||
infraConmonPID := readFirstLine(tmpFile)
|
||||
infraConmonPID := readFirstLine(pidFile)
|
||||
_, err = strconv.Atoi(infraConmonPID) // Make sure it's a proper integer
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
@ -157,13 +159,12 @@ var _ = Describe("Podman pod stop", func() {
|
||||
})
|
||||
|
||||
It("podman pod start/stop single pod via --pod-id-file", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "podID"
|
||||
podIDFile := filepath.Join(tempdir, "podID")
|
||||
|
||||
podName := "rudolph"
|
||||
|
||||
// Create a pod with --pod-id-file.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -172,26 +173,24 @@ var _ = Describe("Podman pod stop", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", tmpFile})
|
||||
session = podmanTest.Podman([]string{"pod", "start", "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2)) // infra+top
|
||||
|
||||
session = podmanTest.Podman([]string{"pod", "stop", "--pod-id-file", tmpFile})
|
||||
session = podmanTest.Podman([]string{"pod", "stop", "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman pod start/stop multiple pods via --pod-id-file", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
|
||||
podIDFiles := []string{}
|
||||
for _, i := range "0123456789" {
|
||||
tmpFile := tmpDir + "cid" + string(i)
|
||||
podIDFile := filepath.Join(tempdir, "cid"+string(i))
|
||||
podName := "rudolph" + string(i)
|
||||
// Create a pod with --pod-id-file.
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", tmpFile})
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--pod-id-file", podIDFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -202,7 +201,7 @@ var _ = Describe("Podman pod stop", func() {
|
||||
|
||||
// Append the id files along with the command.
|
||||
podIDFiles = append(podIDFiles, "--pod-id-file")
|
||||
podIDFiles = append(podIDFiles, tmpFile)
|
||||
podIDFiles = append(podIDFiles, podIDFile)
|
||||
}
|
||||
|
||||
cmd := []string{"pod", "start"}
|
||||
|
@ -2,6 +2,7 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
@ -232,10 +233,9 @@ var _ = Describe("Podman restart", func() {
|
||||
})
|
||||
|
||||
It("podman restart --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "cid"
|
||||
cidFile := filepath.Join(tempdir, "cid")
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", cidFile, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToStringArray()[0]
|
||||
@ -244,7 +244,7 @@ var _ = Describe("Podman restart", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"restart", "--cidfile", tmpFile})
|
||||
result := podmanTest.Podman([]string{"restart", "--cidfile", cidFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
// FIXME - #20196: Cannot use ExitCleanly()
|
||||
Expect(result).Should(Exit(0))
|
||||
@ -253,23 +253,22 @@ var _ = Describe("Podman restart", func() {
|
||||
})
|
||||
|
||||
It("podman restart multiple --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
cidFile1 := filepath.Join(tempdir, "cid-1")
|
||||
cidFile2 := filepath.Join(tempdir, "cid-2")
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", tmpFile1, "-d", ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", cidFile1, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid1 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", tmpFile2, "-d", ALPINE, "top"})
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", cidFile2, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid2 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
||||
|
||||
result := podmanTest.Podman([]string{"restart", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result := podmanTest.Podman([]string{"restart", "--cidfile", cidFile1, "--cidfile", cidFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
|
@ -2,6 +2,7 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
@ -122,16 +123,15 @@ var _ = Describe("Podman rm", func() {
|
||||
})
|
||||
|
||||
It("podman rm --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "cid"
|
||||
cidFile := filepath.Join(tempdir, "cid")
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "ls"})
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", cidFile, ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
result := podmanTest.Podman([]string{"rm", "--cidfile", tmpFile})
|
||||
result := podmanTest.Podman([]string{"rm", "--cidfile", cidFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
@ -140,23 +140,22 @@ var _ = Describe("Podman rm", func() {
|
||||
})
|
||||
|
||||
It("podman rm multiple --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
cidFile1 := filepath.Join(tempdir, "cid-1")
|
||||
cidFile2 := filepath.Join(tempdir, "cid-2")
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile1, ALPINE, "ls"})
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", cidFile1, ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid1 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--cidfile", tmpFile2, ALPINE, "ls"})
|
||||
session = podmanTest.Podman([]string{"create", "--cidfile", cidFile2, ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid2 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
||||
|
||||
result := podmanTest.Podman([]string{"rm", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result := podmanTest.Podman([]string{"rm", "--cidfile", cidFile1, "--cidfile", cidFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
|
@ -758,11 +758,19 @@ USER bin`, BB)
|
||||
})
|
||||
|
||||
It("podman run with cidfile", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", tempdir + "cidfile", ALPINE, "ls"})
|
||||
cidFile := filepath.Join(tempdir, "cidfile")
|
||||
session := podmanTest.Podman([]string{"run", "--name", "cidtest", "--cidfile", cidFile, CITEST_IMAGE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
err := os.Remove(tempdir + "cidfile")
|
||||
|
||||
cidFromFile, err := os.ReadFile(cidFile)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Id}}", "cidtest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
Expect(string(cidFromFile)).To(Equal(session.OutputToString()), "CID from cidfile == CID from podman inspect")
|
||||
})
|
||||
|
||||
It("podman run sysctl test", func() {
|
||||
@ -924,7 +932,7 @@ USER bin`, BB)
|
||||
|
||||
It("podman test hooks", func() {
|
||||
SkipIfRemote("--hooks-dir does not work with remote")
|
||||
hooksDir := tempdir + "/hooks,withcomma"
|
||||
hooksDir := filepath.Join(tempdir, "hooks,withcomma")
|
||||
err := os.Mkdir(hooksDir, 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
hookJSONPath := filepath.Join(hooksDir, "checkhooks.json")
|
||||
@ -977,7 +985,7 @@ echo -n %s >%s
|
||||
err = os.WriteFile(secretsFile, []byte(secretsString), 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
targetDir := tempdir + "/symlink/target"
|
||||
targetDir := filepath.Join(tempdir, "symlink/target")
|
||||
err = os.MkdirAll(targetDir, 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
keyFile := filepath.Join(targetDir, "key.pem")
|
||||
@ -2103,7 +2111,7 @@ WORKDIR /madethis`, BB)
|
||||
|
||||
It("podman run with pidfile", func() {
|
||||
SkipIfRemote("pidfile not handled by remote")
|
||||
pidfile := tempdir + "pidfile"
|
||||
pidfile := filepath.Join(tempdir, "pidfile")
|
||||
session := podmanTest.Podman([]string{"run", "--pidfile", pidfile, ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
@ -3,6 +3,7 @@ package integration
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -172,7 +173,7 @@ var _ = Describe("Podman start", func() {
|
||||
|
||||
It("podman start container with special pidfile", func() {
|
||||
SkipIfRemote("pidfile not handled by remote")
|
||||
pidfile := tempdir + "pidfile"
|
||||
pidfile := filepath.Join(tempdir, "pidfile")
|
||||
session := podmanTest.Podman([]string{"create", "--pidfile", pidfile, ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
@ -2,6 +2,7 @@ package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
. "github.com/containers/podman/v5/test/utils"
|
||||
@ -258,10 +259,9 @@ var _ = Describe("Podman stop", func() {
|
||||
})
|
||||
|
||||
It("podman stop --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile := tmpDir + "cid"
|
||||
cidFile := filepath.Join(tempdir, "cid")
|
||||
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", tmpFile, ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"create", "--cidfile", cidFile, ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid := session.OutputToStringArray()[0]
|
||||
@ -270,7 +270,7 @@ var _ = Describe("Podman stop", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
result := podmanTest.Podman([]string{"stop", "--cidfile", tmpFile})
|
||||
result := podmanTest.Podman([]string{"stop", "--cidfile", cidFile})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
@ -278,23 +278,22 @@ var _ = Describe("Podman stop", func() {
|
||||
})
|
||||
|
||||
It("podman stop multiple --cidfile", func() {
|
||||
tmpDir := GinkgoT().TempDir()
|
||||
tmpFile1 := tmpDir + "cid-1"
|
||||
tmpFile2 := tmpDir + "cid-2"
|
||||
cidFile1 := filepath.Join(tempdir, "cid-1")
|
||||
cidFile2 := filepath.Join(tempdir, "cid-2")
|
||||
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", tmpFile1, "-d", ALPINE, "top"})
|
||||
session := podmanTest.Podman([]string{"run", "--cidfile", cidFile1, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid1 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", tmpFile2, "-d", ALPINE, "top"})
|
||||
session = podmanTest.Podman([]string{"run", "--cidfile", cidFile2, "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
cid2 := session.OutputToStringArray()[0]
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(2))
|
||||
|
||||
result := podmanTest.Podman([]string{"stop", "--cidfile", tmpFile1, "--cidfile", tmpFile2})
|
||||
result := podmanTest.Podman([]string{"stop", "--cidfile", cidFile1, "--cidfile", cidFile2})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(ExitCleanly())
|
||||
output := result.OutputToString()
|
||||
|
Reference in New Issue
Block a user