summaryrefslogtreecommitdiff
path: root/test/e2e/systemd_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-23 14:18:12 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-03-28 16:30:47 -0400
commitcdf74f20820a578ea515e67b00a13714ff8bd6f2 (patch)
treeda66e7cd3cb0910cdbef663b9e9533e40fc861a1 /test/e2e/systemd_test.go
parentc75030590cc992d87dbd8dc02501d3bad257fd84 (diff)
downloadpodman-cdf74f20820a578ea515e67b00a13714ff8bd6f2.tar.gz
podman-cdf74f20820a578ea515e67b00a13714ff8bd6f2.tar.bz2
podman-cdf74f20820a578ea515e67b00a13714ff8bd6f2.zip
Set systemd mode if entrypoint begins with /bin/sh -c
Fixes: https://github.com/containers/podman/issues/13324 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/e2e/systemd_test.go')
-rw-r--r--test/e2e/systemd_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index f8d8db592..57fc323ce 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -1,8 +1,10 @@
package integration
import (
+ "fmt"
"io/ioutil"
"os"
+ "path/filepath"
"strings"
. "github.com/containers/podman/v4/test/utils"
@@ -130,6 +132,31 @@ WantedBy=default.target
Expect(conData[0].Config.SystemdMode).To(BeTrue())
})
+ It("podman systemd in command triggers systemd mode", func() {
+ containerfile := fmt.Sprintf(`FROM %s
+RUN mkdir -p /usr/lib/systemd/; touch /usr/lib/systemd/systemd
+CMD /usr/lib/systemd/systemd`, ALPINE)
+
+ containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
+ err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755)
+ Expect(err).To(BeNil())
+ session := podmanTest.Podman([]string{"build", "-t", "systemd", "--file", containerfilePath, podmanTest.TempDir})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ ctrName := "testCtr"
+ run := podmanTest.Podman([]string{"create", "--name", ctrName, "systemd"})
+ run.WaitWithDefaultTimeout()
+ Expect(run).Should(Exit(0))
+
+ result := podmanTest.Podman([]string{"inspect", ctrName})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ conData := result.InspectContainerToJSON()
+ Expect(conData).To(HaveLen(1))
+ Expect(conData[0].Config.SystemdMode).To(BeTrue())
+ })
+
It("podman create container with --uidmap and conmon PidFile accessible", func() {
ctrName := "testCtrUidMap"
run := podmanTest.Podman([]string{"run", "-d", "--uidmap=0:1:1000", "--name", ctrName, ALPINE, "top"})