diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/buildah-bud/buildah-tests.diff | 2 | ||||
-rw-r--r-- | test/e2e/containers_conf_test.go | 47 | ||||
-rw-r--r-- | test/e2e/pod_create_test.go | 34 | ||||
-rw-r--r-- | test/e2e/run_test.go | 53 | ||||
-rw-r--r-- | test/system/070-build.bats | 2 |
5 files changed, 115 insertions, 23 deletions
diff --git a/test/buildah-bud/buildah-tests.diff b/test/buildah-bud/buildah-tests.diff index bb28e11c9..87923484f 100644 --- a/test/buildah-bud/buildah-tests.diff +++ b/test/buildah-bud/buildah-tests.diff @@ -70,7 +70,7 @@ index 166316d5..775d7c9b 100644 + local podman_or_buildah=${BUILDAH_BINARY} + local _opts="${ROOTDIR_OPTS} ${BUILDAH_REGISTRY_OPTS}" -+ if [[ $1 == "bud" || $1 == "build-using-dockerfile" ]]; then ++ if [[ $1 == "build" || $1 == "build-using-dockerfile" ]]; then + shift + # podman defaults to --layers=true; buildah to --false. + # If command line includes explicit --layers, leave it untouched, diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index 08fc4e6cc..f5e85e723 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -397,4 +397,51 @@ var _ = Describe("Podman run", func() { Expect(session).Should(Exit(0)) Expect(session.OutputToString()).To(Equal(profile)) }) + + It("podman info image_copy_tmp_dir", func() { + session := podmanTest.Podman([]string{"info", "--format", "{{.Store.ImageCopyTmpDir}}"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(Equal("/var/tmp")) + + configPath := filepath.Join(podmanTest.TempDir, "containers.conf") + os.Setenv("CONTAINERS_CONF", configPath) + + containersConf := []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=\"/foobar\"")) + err = ioutil.WriteFile(configPath, containersConf, os.ModePerm) + Expect(err).To(BeNil()) + + if IsRemote() { + podmanTest.RestartRemoteService() + } + + session = podmanTest.Podman([]string{"info", "--format", "{{.Store.ImageCopyTmpDir}}"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(Equal("/foobar")) + + containersConf = []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=\"storage\"")) + err = ioutil.WriteFile(configPath, containersConf, os.ModePerm) + Expect(err).To(BeNil()) + if IsRemote() { + podmanTest.RestartRemoteService() + } + + session = podmanTest.Podman([]string{"info", "--format", "{{.Store.ImageCopyTmpDir}}"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.LineInOutputContains("containers/storage/tmp")).To(BeTrue()) + + containersConf = []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=\"storage1\"")) + err = ioutil.WriteFile(configPath, containersConf, os.ModePerm) + Expect(err).To(BeNil()) + if IsRemote() { + podmanTest.RestartRemoteService() + } + + session = podmanTest.Podman([]string{"info", "--format", "{{.Store.ImageCopyTmpDir}}"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.ErrorToString()).To(ContainSubstring("invalid image_copy_tmp_dir")) + }) }) diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index 7297bfc6e..7d40d36dd 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -850,4 +850,38 @@ ENTRYPOINT ["sleep","99999"] Expect(ok).To(BeTrue()) }) + It("podman pod create --volume", func() { + volName := "testVol" + volCreate := podmanTest.Podman([]string{"volume", "create", volName}) + volCreate.WaitWithDefaultTimeout() + Expect(volCreate).Should(Exit(0)) + podName := "testPod" + podCreate := podmanTest.Podman([]string{"pod", "create", "--volume", volName + ":/tmp1", "--name", podName}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate).Should(Exit(0)) + podInspect := podmanTest.Podman([]string{"pod", "inspect", podName}) + podInspect.WaitWithDefaultTimeout() + Expect(podInspect).Should(Exit(0)) + data := podInspect.InspectPodToJSON() + Expect(data.Mounts[0].Name).To(Equal(volName)) + ctrName := "testCtr" + ctrCreate := podmanTest.Podman([]string{"create", "--pod", podName, "--name", ctrName, ALPINE}) + ctrCreate.WaitWithDefaultTimeout() + Expect(ctrCreate).Should(Exit(0)) + ctrInspect := podmanTest.Podman([]string{"inspect", ctrName}) + ctrInspect.WaitWithDefaultTimeout() + Expect(ctrInspect).Should(Exit(0)) + ctrData := ctrInspect.InspectContainerToJSON() + Expect(ctrData[0].Mounts[0].Name).To(Equal(volName)) + + ctr2 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "sh", "-c", "echo hello >> " + "/tmp1/test"}) + ctr2.WaitWithDefaultTimeout() + Expect(ctr2).Should(Exit(0)) + + ctr3 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "cat", "/tmp1/test"}) + ctr3.WaitWithDefaultTimeout() + Expect(ctr3.OutputToString()).To(ContainSubstring("hello")) + + }) + }) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index cb61aba21..ec4b0d997 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1296,31 +1296,42 @@ USER mail`, BB) SkipIfRootlessCgroupsV1("Disable cgroups not supported on cgroupv1 for rootless users") SkipIfRemote("--cgroups=split cannot be used in remote mode") - container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"}) - container.WaitWithDefaultTimeout() - Expect(container).Should(Exit(0)) - lines := container.OutputToStringArray() - - cgroup := "" - for _, line := range lines { - parts := strings.SplitN(line, ":", 3) - if !CGROUPSV2 { - // ignore unified on cgroup v1. - // both runc and crun do not set it. - // crun does not set named hierarchies. - if parts[1] == "" || strings.Contains(parts[1], "name=") { + checkLines := func(lines []string) { + cgroup := "" + for _, line := range lines { + parts := strings.SplitN(line, ":", 3) + if len(parts) < 2 { continue } + if !CGROUPSV2 { + // ignore unified on cgroup v1. + // both runc and crun do not set it. + // crun does not set named hierarchies. + if parts[1] == "" || strings.Contains(parts[1], "name=") { + continue + } + } + if parts[2] == "/" { + continue + } + if cgroup == "" { + cgroup = parts[2] + continue + } + Expect(cgroup).To(Equal(parts[2])) } - if parts[2] == "/" { - continue - } - if cgroup == "" { - cgroup = parts[2] - continue - } - Expect(cgroup).To(Equal(parts[2])) } + + container := podmanTest.Podman([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"}) + container.WaitWithDefaultTimeout() + Expect(container).Should(Exit(0)) + checkLines(container.OutputToStringArray()) + + // check that --cgroups=split is honored also when a container runs in a pod + container = podmanTest.Podman([]string{"run", "--rm", "--pod", "new:split-test-pod", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"}) + container.WaitWithDefaultTimeout() + Expect(container).Should(Exit(0)) + checkLines(container.OutputToStringArray()) }) It("podman run with cgroups=disabled runs without cgroups", func() { diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 47db08eb1..03c7984e2 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -464,7 +464,7 @@ Labels.$label_name | $label_value local -a files=( -test1 -test1.txt test2 test2.txt - subdir/sub1 subdir/sub1.txt + -subdir/sub1 -subdir/sub1.txt -subdir/sub2 -subdir/sub2.txt this-file-does-not-match-anything-in-ignore-file comment |