summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/e2e/container_inspect_test.go45
-rw-r--r--test/e2e/run_test.go71
-rw-r--r--test/e2e/run_volume_test.go21
3 files changed, 137 insertions, 0 deletions
diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go
new file mode 100644
index 000000000..91c025197
--- /dev/null
+++ b/test/e2e/container_inspect_test.go
@@ -0,0 +1,45 @@
+package integration
+
+import (
+ "os"
+
+ "github.com/containers/libpod/pkg/annotations"
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman container inspect", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
+ podmanTest.SeedImages()
+ })
+
+ AfterEach(func() {
+ podmanTest.CleanupPod()
+ f := CurrentGinkgoTestDescription()
+ processTestResult(f)
+ })
+
+ It("podman inspect a container for the container manager annotation", func() {
+ const testContainer = "container-inspect-test-1"
+ setup := podmanTest.RunTopContainer(testContainer)
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ data := podmanTest.InspectContainer(testContainer)
+ Expect(data[0].Config.Annotations[annotations.ContainerManager]).
+ To(Equal(annotations.ContainerManagerLibpod))
+ })
+})
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 6e102cfa5..4d2cee8e3 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -903,4 +903,75 @@ USER mail`
}
Expect(found).To(BeTrue())
})
+
+ It("podman run with cgroups=disabled runs without cgroups", func() {
+ SkipIfRemote()
+ SkipIfRootless()
+ // Only works on crun
+ if !strings.Contains(podmanTest.OCIRuntime, "crun") {
+ Skip("Test only works on crun")
+ }
+
+ curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup")
+ Expect(err).To(BeNil())
+ var curCgroups string = string(curCgroupsBytes)
+ fmt.Printf("Output:\n%s\n", curCgroups)
+ Expect(curCgroups).To(Not(Equal("")))
+
+ ctrName := "testctr"
+ container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=disabled", ALPINE, "top"})
+ container.WaitWithDefaultTimeout()
+ Expect(container.ExitCode()).To(Equal(0))
+
+ // Get PID and get cgroups of that PID
+ inspectOut := podmanTest.InspectContainer(ctrName)
+ Expect(len(inspectOut)).To(Equal(1))
+ pid := inspectOut[0].State.Pid
+ Expect(pid).To(Not(Equal(0)))
+ Expect(inspectOut[0].HostConfig.CgroupParent).To(Equal(""))
+
+ ctrCgroupsBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid))
+ Expect(err).To(BeNil())
+ var ctrCgroups string = string(ctrCgroupsBytes)
+ fmt.Printf("Output\n:%s\n", ctrCgroups)
+ Expect(curCgroups).To(Equal(ctrCgroups))
+ })
+
+ It("podman run with cgroups=enabled makes cgroups", func() {
+ SkipIfRemote()
+ SkipIfRootless()
+ // Only works on crun
+ if !strings.Contains(podmanTest.OCIRuntime, "crun") {
+ Skip("Test only works on crun")
+ }
+
+ curCgroupsBytes, err := ioutil.ReadFile("/proc/self/cgroup")
+ Expect(err).To(BeNil())
+ var curCgroups string = string(curCgroupsBytes)
+ fmt.Printf("Output:\n%s\n", curCgroups)
+ Expect(curCgroups).To(Not(Equal("")))
+
+ ctrName := "testctr"
+ container := podmanTest.Podman([]string{"run", "--name", ctrName, "-d", "--cgroups=enabled", ALPINE, "top"})
+ container.WaitWithDefaultTimeout()
+ Expect(container.ExitCode()).To(Equal(0))
+
+ // Get PID and get cgroups of that PID
+ inspectOut := podmanTest.InspectContainer(ctrName)
+ Expect(len(inspectOut)).To(Equal(1))
+ pid := inspectOut[0].State.Pid
+ Expect(pid).To(Not(Equal(0)))
+
+ ctrCgroupsBytes, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid))
+ Expect(err).To(BeNil())
+ var ctrCgroups string = string(ctrCgroupsBytes)
+ fmt.Printf("Output\n:%s\n", ctrCgroups)
+ Expect(curCgroups).To(Not(Equal(ctrCgroups)))
+ })
+
+ It("podman run with cgroups=garbage errors", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--cgroups=garbage", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
})
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 551e86b93..fc1998ab2 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -249,4 +249,25 @@ var _ = Describe("Podman run with volumes", func() {
fmt.Printf("Output: %s", mountOut3)
Expect(strings.Contains(mountOut3, volName)).To(BeFalse())
})
+
+ It("podman named volume copyup", func() {
+ baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/etc/apk/"})
+ baselineSession.WaitWithDefaultTimeout()
+ Expect(baselineSession.ExitCode()).To(Equal(0))
+ baselineOutput := baselineSession.OutputToString()
+
+ inlineVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "-v", "testvol1:/etc/apk", ALPINE, "ls", "/etc/apk/"})
+ inlineVolumeSession.WaitWithDefaultTimeout()
+ Expect(inlineVolumeSession.ExitCode()).To(Equal(0))
+ Expect(inlineVolumeSession.OutputToString()).To(Equal(baselineOutput))
+
+ makeVolumeSession := podmanTest.Podman([]string{"volume", "create", "testvol2"})
+ makeVolumeSession.WaitWithDefaultTimeout()
+ Expect(makeVolumeSession.ExitCode()).To(Equal(0))
+
+ separateVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "-v", "testvol2:/etc/apk", ALPINE, "ls", "/etc/apk/"})
+ separateVolumeSession.WaitWithDefaultTimeout()
+ Expect(separateVolumeSession.ExitCode()).To(Equal(0))
+ Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput))
+ })
})