summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/pod_pod_namespaces.go19
-rw-r--r--test/system/200-pod.bats24
-rw-r--r--test/utils/utils.go14
3 files changed, 50 insertions, 7 deletions
diff --git a/test/e2e/pod_pod_namespaces.go b/test/e2e/pod_pod_namespaces.go
index 41e9c5683..20b8bdb39 100644
--- a/test/e2e/pod_pod_namespaces.go
+++ b/test/e2e/pod_pod_namespaces.go
@@ -60,6 +60,25 @@ var _ = Describe("Podman pod create", func() {
Expect(NAMESPACE1).To(Equal(NAMESPACE2))
})
+ It("podman pod container share ipc && /dev/shm ", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "start", podID})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--pod", podID, ALPINE, "touch", "/dev/shm/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "--rm", "--pod", podID, ALPINE, "ls", "/dev/shm/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman pod container dontshare PIDNS", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 1d17c8cad..b0f645c53 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -116,6 +116,30 @@ function teardown() {
run_podman 1 pod exists $podname
}
+@test "podman pod - communicating via /dev/shm " {
+ if is_remote && is_rootless; then
+ skip "FIXME: pending #7139"
+ fi
+
+ podname=pod$(random_string)
+ run_podman 1 pod exists $podname
+ run_podman pod create --infra=true --name=$podname
+ podid="$output"
+ run_podman pod exists $podname
+ run_podman pod exists $podid
+
+ run_podman run --rm --pod $podname $IMAGE touch /dev/shm/test1
+ run_podman run --rm --pod $podname $IMAGE ls /dev/shm/test1
+ is "$output" "/dev/shm/test1"
+
+ # ...then rm the pod, then rmi the pause image so we don't leave strays.
+ run_podman pod rm $podname
+
+ # Pod no longer exists
+ run_podman 1 pod exists $podid
+ run_podman 1 pod exists $podname
+}
+
# Random byte
function octet() {
echo $(( $RANDOM & 255 ))
diff --git a/test/utils/utils.go b/test/utils/utils.go
index cb76d4a54..dd836f258 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -14,7 +14,7 @@ import (
"github.com/containers/storage/pkg/parsers/kernel"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
- "github.com/onsi/gomega/gexec"
+ . "github.com/onsi/gomega/gexec"
)
var (
@@ -48,7 +48,7 @@ type PodmanTest struct {
// PodmanSession wraps the gexec.session so we can extend it
type PodmanSession struct {
- *gexec.Session
+ *Session
}
// HostOS is a simple struct for the test os
@@ -96,7 +96,7 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string
command.ExtraFiles = extraFiles
- session, err := gexec.Start(command, GinkgoWriter, GinkgoWriter)
+ session, err := Start(command, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run podman command: %s\n%v", strings.Join(podmanOptions, " "), err))
}
@@ -125,7 +125,7 @@ func (p *PodmanTest) NumberOfContainersRunning() int {
var containers []string
ps := p.PodmanBase([]string{"ps", "-q"}, false, true)
ps.WaitWithDefaultTimeout()
- Expect(ps.ExitCode()).To(Equal(0))
+ Expect(ps).Should(Exit(0))
for _, i := range ps.OutputToStringArray() {
if i != "" {
containers = append(containers, i)
@@ -318,7 +318,7 @@ func (s *PodmanSession) IsJSONOutputValid() bool {
// WaitWithDefaultTimeout waits for process finished with defaultWaitTimeout
func (s *PodmanSession) WaitWithDefaultTimeout() {
- Eventually(s, defaultWaitTimeout).Should(gexec.Exit())
+ Eventually(s, defaultWaitTimeout).Should(Exit())
os.Stdout.Sync()
os.Stderr.Sync()
fmt.Println("output:", s.OutputToString())
@@ -332,7 +332,7 @@ func CreateTempDirInTempDir() (string, error) {
// SystemExec is used to exec a system command to check its exit code or output
func SystemExec(command string, args []string) *PodmanSession {
c := exec.Command(command, args...)
- session, err := gexec.Start(c, GinkgoWriter, GinkgoWriter)
+ session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
}
@@ -343,7 +343,7 @@ func SystemExec(command string, args []string) *PodmanSession {
// StartSystemExec is used to start exec a system command
func StartSystemExec(command string, args []string) *PodmanSession {
c := exec.Command(command, args...)
- session, err := gexec.Start(c, GinkgoWriter, GinkgoWriter)
+ session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
}