diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/30-volumes.at | 20 | ||||
-rw-r--r-- | test/apiv2/35-networks.at | 48 | ||||
-rw-r--r-- | test/e2e/build_test.go | 42 | ||||
-rw-r--r-- | test/e2e/common_test.go | 2 | ||||
-rw-r--r-- | test/e2e/generate_kube_test.go | 4 | ||||
-rw-r--r-- | test/e2e/run_test.go | 24 |
6 files changed, 103 insertions, 37 deletions
diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at index 1a40b3cdf..18ff31100 100644 --- a/test/apiv2/30-volumes.at +++ b/test/apiv2/30-volumes.at @@ -86,14 +86,34 @@ t DELETE libpod/volumes/foo1 404 \ .message~.* \ .response=404 +#compat api list volumes sanity checks +t GET volumes?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET volumes?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + +#libpod api list volumes sanity checks +t GET libpod/volumes/json?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET libpod/volumes/json?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + # Prune volumes - bad filter input t POST volumes/prune?filters='garb1age}' 500 \ .cause="invalid character 'g' looking for beginning of value" +t POST libpod/volumes/prune?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" ## Prune volumes with label matching 'testlabel1=testonly' t POST libpod/volumes/prune?filters='{"label":["testlabel1=testonly"]}' 200 t GET libpod/volumes/json?filters='{"label":["testlabel1=testonly"]}' 200 length=0 +## Prune volumes with label illformed label +t POST volumes/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" +t POST libpod/volumes/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" + ## Prune volumes with label matching 'testlabel' t POST libpod/volumes/prune?filters='{"label":["testlabel"]}' 200 t GET libpod/volumes/json?filters='{"label":["testlabel"]}' 200 length=0 diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at index ce7ca628a..21840a42d 100644 --- a/test/apiv2/35-networks.at +++ b/test/apiv2/35-networks.at @@ -16,6 +16,20 @@ t POST libpod/networks/create?name=network2 \ 200 \ .Filename~.*/network2\\.conflist +# --data '{"Subnet":{"IP":"10.10.133.0","Mask":[255,255,255,0]},"Labels":{"xyz":"val"}}' +t POST libpod/networks/create?name=network3 \ + Subnet='{"IP":"10.10.133.0","Mask":[255,255,255,0]}' \ + Labels='{"xyz":"val"}' \ + 200 \ + .Filename~.*/network3\\.conflist + +# --data '{"Subnet":{"IP":"10.10.134.0","Mask":[255,255,255,0]},"Labels":{"zaq":"val"}}' +t POST libpod/networks/create?name=network4 \ + Subnet='{"IP":"10.10.134.0","Mask":[255,255,255,0]}' \ + Labels='{"zaq":"val"}' \ + 200 \ + .Filename~.*/network4\\.conflist + # test for empty mask t POST libpod/networks/create Subnet='{"IP":"10.10.1.0","Mask":[]}' 500 \ .cause~'.*cannot be empty' @@ -38,7 +52,7 @@ t GET libpod/networks/network1/json 200 \ t GET networks?filters='{"name":["network1","network2"]}' 200 \ length=2 t GET networks?filters='{"name":["network"]}' 200 \ - length=2 + length=4 t GET networks?filters='{"label":["abc"]}' 200 \ length=1 # old docker filter type see #9526 @@ -66,6 +80,38 @@ t POST networks/create Name=net3\ IPAM='{"Config":[]}' 201 # network delete docker t DELETE networks/net3 204 +#compat api list networks sanity checks +t GET networks?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET networks?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + +#libpod api list networks sanity checks +t GET libpod/networks/json?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET libpod/networks/json?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + +# Prune networks compat api +t POST networks/prune?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t POST networks/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" + +# Prune networks libpod api +t POST libpod/networks/prune?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t POST libpod/networks/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" + +# prune networks using filter - compat api +t POST networks/prune?filters='{"label":["xyz"]}' 200 +t GET networks/json?filters='{"label":["xyz"]}' 404 + +# prune networks using filter - libpod api +t POST libpod/networks/prune?filters='{"label":["zaq=val"]}' 200 +t GET libpod/networks/json?filters='{"label":["zaq=val"]}' 200 length=0 + # clean the network t DELETE libpod/networks/network1 200 \ .[0].Name~network1 \ diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go index 4839d66ec..e061a2154 100644 --- a/test/e2e/build_test.go +++ b/test/e2e/build_test.go @@ -39,7 +39,7 @@ var _ = Describe("Podman build", func() { // happy and then clean up after ourselves to make sure that works too. It("podman build and remove basic alpine", func() { podmanTest.AddImageToRWStore(ALPINE) - session := podmanTest.Podman([]string{"build", "build/basicalpine"}) + session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -59,7 +59,7 @@ var _ = Describe("Podman build", func() { It("podman build with logfile", func() { logfile := filepath.Join(podmanTest.TempDir, "logfile") - session := podmanTest.Podman([]string{"build", "--tag", "test", "--logfile", logfile, "build/basicalpine"}) + session := podmanTest.Podman([]string{"build", "--pull-never", "--tag", "test", "--logfile", logfile, "build/basicalpine"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -82,7 +82,7 @@ var _ = Describe("Podman build", func() { // If the context directory is pointing at a file and not a directory, // that's a no no, fail out. It("podman build context directory a file", func() { - session := podmanTest.Podman([]string{"build", "build/context_dir_a_file"}) + session := podmanTest.Podman([]string{"build", "--pull-never", "build/context_dir_a_file"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(125)) }) @@ -90,7 +90,7 @@ var _ = Describe("Podman build", func() { // Check that builds with different values for the squash options // create the appropriate number of layers, then clean up after. It("podman build basic alpine with squash", func() { - session := podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-a", "-t", "test-squash-a:latest", "build/squash"}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-a", "-t", "test-squash-a:latest", "build/squash"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -100,7 +100,7 @@ var _ = Describe("Podman build", func() { // Check for two layers Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2)) - session = podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-b", "--squash", "-t", "test-squash-b:latest", "build/squash"}) + session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-b", "--squash", "-t", "test-squash-b:latest", "build/squash"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -110,7 +110,7 @@ var _ = Describe("Podman build", func() { // Check for three layers Expect(len(strings.Fields(session.OutputToString()))).To(Equal(3)) - session = podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-c", "--squash", "-t", "test-squash-c:latest", "build/squash"}) + session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-c", "--squash", "-t", "test-squash-c:latest", "build/squash"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -120,7 +120,7 @@ var _ = Describe("Podman build", func() { // Check for two layers Expect(len(strings.Fields(session.OutputToString()))).To(Equal(2)) - session = podmanTest.Podman([]string{"build", "-f", "build/squash/Dockerfile.squash-c", "--squash-all", "-t", "test-squash-d:latest", "build/squash"}) + session = podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/squash/Dockerfile.squash-c", "--squash-all", "-t", "test-squash-d:latest", "build/squash"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -162,7 +162,7 @@ var _ = Describe("Podman build", func() { // When session := podmanTest.Podman([]string{ - "build", "-f", targetFile, "-t", "test-locations", + "build", "--pull-never", "-f", targetFile, "-t", "test-locations", }) session.WaitWithDefaultTimeout() @@ -185,7 +185,7 @@ var _ = Describe("Podman build", func() { } targetFile := filepath.Join(targetPath, "idFile") - session := podmanTest.Podman([]string{"build", "build/basicalpine", "--iidfile", targetFile}) + session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine", "--iidfile", targetFile}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) id, _ := ioutil.ReadFile(targetFile) @@ -200,7 +200,7 @@ var _ = Describe("Podman build", func() { It("podman Test PATH in built image", func() { path := "/tmp:/bin:/usr/bin:/usr/sbin" session := podmanTest.Podman([]string{ - "build", "-f", "build/basicalpine/Containerfile.path", "-t", "test-path", + "build", "--pull-never", "-f", "build/basicalpine/Containerfile.path", "-t", "test-path", }) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -225,7 +225,7 @@ RUN printenv http_proxy` dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile") err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755) Expect(err).To(BeNil()) - session := podmanTest.Podman([]string{"build", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir}) + session := podmanTest.Podman([]string{"build", "--pull-never", "--http-proxy", "--file", dockerfilePath, podmanTest.TempDir}) session.Wait(120) Expect(session.ExitCode()).To(Equal(0)) ok, _ := session.GrepString("1.2.3.4") @@ -234,7 +234,7 @@ RUN printenv http_proxy` }) It("podman build and check identity", func() { - session := podmanTest.Podman([]string{"build", "-f", "build/basicalpine/Containerfile.path", "--no-cache", "-t", "test", "build/basicalpine"}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-f", "build/basicalpine/Containerfile.path", "--no-cache", "-t", "test", "build/basicalpine"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -279,7 +279,7 @@ RUN find /test` // make cwd as context root path Expect(os.Chdir(targetPath)).To(BeNil()) - session := podmanTest.Podman([]string{"build", "-t", "test", "-f", "Containerfile", targetSubPath}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "Containerfile", targetSubPath}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) ok, _ := session.GrepString("/test/dummy") @@ -321,7 +321,7 @@ RUN find /test` // make cwd as context root path Expect(os.Chdir(targetPath)).To(BeNil()) - session := podmanTest.Podman([]string{"build", "-t", "test", "-f", "subdir/Containerfile", "."}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "-f", "subdir/Containerfile", "."}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) }) @@ -445,7 +445,7 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR` // make cwd as context root path Expect(os.Chdir(targetPath)).To(BeNil()) - session := podmanTest.Podman([]string{"build", "-t", "test", targetSubPath}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", targetSubPath}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) ok, _ := session.GrepString("/test/dummy") @@ -475,7 +475,7 @@ RUN grep CapEff /proc/self/status` // When session := podmanTest.Podman([]string{ - "build", "--cap-drop=all", "--cap-add=net_bind_service", "--add-host", "testhost:1.2.3.4", "--from", "alpine", targetPath, + "build", "--pull-never", "--cap-drop=all", "--cap-add=net_bind_service", "--add-host", "testhost:1.2.3.4", "--from", "alpine", targetPath, }) session.WaitWithDefaultTimeout() @@ -502,7 +502,7 @@ RUN grep CapEff /proc/self/status` // When session := podmanTest.Podman([]string{ - "build", "--isolation", "oci", "--arch", "arm64", targetPath, + "build", "--pull-never", "--isolation", "oci", "--arch", "arm64", targetPath, }) session.WaitWithDefaultTimeout() // Then @@ -510,7 +510,7 @@ RUN grep CapEff /proc/self/status` // When session = podmanTest.Podman([]string{ - "build", "--isolation", "chroot", "--arch", "arm64", targetPath, + "build", "--pull-never", "--isolation", "chroot", "--arch", "arm64", targetPath, }) session.WaitWithDefaultTimeout() // Then @@ -518,7 +518,7 @@ RUN grep CapEff /proc/self/status` // When session = podmanTest.Podman([]string{ - "build", "--isolation", "rootless", "--arch", "arm64", targetPath, + "build", "--pull-never", "--isolation", "rootless", "--arch", "arm64", targetPath, }) session.WaitWithDefaultTimeout() // Then @@ -526,7 +526,7 @@ RUN grep CapEff /proc/self/status` // When session = podmanTest.Podman([]string{ - "build", "--isolation", "bogus", "--arch", "arm64", targetPath, + "build", "--pull-never", "--isolation", "bogus", "--arch", "arm64", targetPath, }) session.WaitWithDefaultTimeout() // Then @@ -540,7 +540,7 @@ RUN echo hello` containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile") err := ioutil.WriteFile(containerfilePath, []byte(containerfile), 0755) Expect(err).To(BeNil()) - session := podmanTest.Podman([]string{"build", "-t", "test", "--timestamp", "0", "--file", containerfilePath, podmanTest.TempDir}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-t", "test", "--timestamp", "0", "--file", containerfilePath, podmanTest.TempDir}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 70ffdebea..9ae56d7ce 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -440,7 +440,7 @@ func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers dockerfilePath := filepath.Join(p.TempDir, "Dockerfile") err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755) Expect(err).To(BeNil()) - cmd := []string{"build", "--layers=" + layers, "--file", dockerfilePath} + cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath} if len(imageName) > 0 { cmd = append(cmd, []string{"-t", imageName}...) } diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index 21e006c20..bc7c21785 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -675,7 +675,7 @@ ENTRYPOINT /bin/sleep` Expect(err).To(BeNil()) image := "generatekube:test" - session := podmanTest.Podman([]string{"build", "-f", containerfilePath, "-t", image}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-f", containerfilePath, "-t", image}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -748,7 +748,7 @@ USER test1` Expect(err).To(BeNil()) image := "generatekube:test" - session := podmanTest.Podman([]string{"build", "-f", containerfilePath, "-t", image}) + session := podmanTest.Podman([]string{"build", "--pull-never", "-f", containerfilePath, "-t", image}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 490d05699..4e5106731 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -576,23 +576,23 @@ USER bin` }) It("podman run blkio-weight test", func() { - SkipIfRootless("FIXME: This is blowing up because of no /sys/fs/cgroup/user.slice/user-14467.slice/user@14467.service/cgroup.subtree_control file") SkipIfRootlessCgroupsV1("Setting blkio-weight not supported on cgroupv1 for rootless users") - if !CGROUPSV2 { - if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) { - Skip("Kernel does not support blkio.weight") - } - } - if podmanTest.Host.Distribution == "ubuntu" { - Skip("Ubuntu <= 20.10 lacks BFQ scheduler") - } + SkipIfRootless("By default systemd doesn't delegate io to rootless users") if CGROUPSV2 { - // convert linearly from [10-1000] to [1-10000] - session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/$(sed -e 's|0::||' < /proc/self/cgroup)/io.bfq.weight"}) + if _, err := os.Stat("/sys/fs/cgroup/io.stat"); os.IsNotExist(err) { + Skip("Kernel does not have io.stat") + } + session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "sh", "-c", "cat /sys/fs/cgroup/io.bfq.weight"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) - Expect(session.OutputToString()).To(ContainSubstring("51")) + // there was a documentation issue in the kernel that reported a different range [1-10000] for the io controller. + // older versions of crun/runc used it. For the time being allow both versions to pass the test. + // FIXME: drop "|51" once all the runtimes we test have the fix in place. + Expect(strings.Replace(session.OutputToString(), "default ", "", 1)).To(MatchRegexp("15|51")) } else { + if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) { + Skip("Kernel does not support blkio.weight") + } session := podmanTest.Podman([]string{"run", "--rm", "--blkio-weight=15", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.weight"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) |