diff options
-rw-r--r-- | cmd/podman/common/volumes.go | 29 | ||||
-rw-r--r-- | cmd/podman/system/migrate.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/renumber.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/reset.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/service.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/service_abi.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/service_unsupported.go | 2 | ||||
-rw-r--r-- | cmd/podman/system/varlink.go | 2 | ||||
-rw-r--r-- | pkg/specgen/container_validate.go | 3 | ||||
-rw-r--r-- | test/e2e/images_test.go | 15 | ||||
-rw-r--r-- | test/system/075-exec.bats | 15 | ||||
-rw-r--r-- | test/system/200-pod.bats | 32 | ||||
-rw-r--r-- | test/system/500-networking.bats | 23 |
13 files changed, 80 insertions, 51 deletions
diff --git a/cmd/podman/common/volumes.go b/cmd/podman/common/volumes.go index a70410ad3..63bb8e5f0 100644 --- a/cmd/podman/common/volumes.go +++ b/cmd/podman/common/volumes.go @@ -209,36 +209,21 @@ func getBindMount(args []string) (spec.Mount, error) { switch kv[0] { case "bind-nonrecursive": newMount.Options = append(newMount.Options, "bind") - case "readonly", "read-only": - if setRORW { - return newMount, errors.Wrapf(optionArgError, "cannot pass 'readonly', 'ro', or 'rw' options more than once") - } - setRORW = true - switch len(kv) { - case 1: - newMount.Options = append(newMount.Options, "ro") - case 2: - switch strings.ToLower(kv[1]) { - case "true": - newMount.Options = append(newMount.Options, "ro") - case "false": - // RW is default, so do nothing - default: - return newMount, errors.Wrapf(optionArgError, "readonly must be set to true or false, instead received %q", kv[1]) - } - default: - return newMount, errors.Wrapf(optionArgError, "badly formatted option %q", val) - } - case "ro", "rw": + case "readonly", "ro", "rw": if setRORW { return newMount, errors.Wrapf(optionArgError, "cannot pass 'readonly', 'ro', or 'rw' options more than once") } setRORW = true // Can be formatted as one of: + // readonly + // readonly=[true|false] // ro // ro=[true|false] // rw // rw=[true|false] + if kv[0] == "readonly" { + kv[0] = "ro" + } switch len(kv) { case 1: newMount.Options = append(newMount.Options, kv[0]) @@ -253,7 +238,7 @@ func getBindMount(args []string) (spec.Mount, error) { newMount.Options = append(newMount.Options, "ro") } default: - return newMount, errors.Wrapf(optionArgError, "%s must be set to true or false, instead received %q", kv[0], kv[1]) + return newMount, errors.Wrapf(optionArgError, "'readonly', 'ro', or 'rw' must be set to true or false, instead received %q", kv[1]) } default: return newMount, errors.Wrapf(optionArgError, "badly formatted option %q", val) diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go index 13aa162c7..28c23d88f 100644 --- a/cmd/podman/system/migrate.go +++ b/cmd/podman/system/migrate.go @@ -1,3 +1,5 @@ +// +build !remote + package system import ( diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go index 5ee6b3be6..b90640de3 100644 --- a/cmd/podman/system/renumber.go +++ b/cmd/podman/system/renumber.go @@ -1,3 +1,5 @@ +// +build !remote + package system import ( diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go index 6caa91690..b16fbd9c7 100644 --- a/cmd/podman/system/reset.go +++ b/cmd/podman/system/reset.go @@ -1,3 +1,5 @@ +// +build !remote + package system import ( diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go index 0f42ae28b..1b07ee301 100644 --- a/cmd/podman/system/service.go +++ b/cmd/podman/system/service.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,!remote package system diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go index 3da6ccfc7..501650839 100644 --- a/cmd/podman/system/service_abi.go +++ b/cmd/podman/system/service_abi.go @@ -1,4 +1,4 @@ -// +build ABISupport +// +build ABISupport,!remote package system diff --git a/cmd/podman/system/service_unsupported.go b/cmd/podman/system/service_unsupported.go index 95f8189f6..82272c882 100644 --- a/cmd/podman/system/service_unsupported.go +++ b/cmd/podman/system/service_unsupported.go @@ -1,4 +1,4 @@ -// +build !ABISupport +// +build !ABISupport,!remote package system diff --git a/cmd/podman/system/varlink.go b/cmd/podman/system/varlink.go index 6a38b3d28..19535e539 100644 --- a/cmd/podman/system/varlink.go +++ b/cmd/podman/system/varlink.go @@ -1,4 +1,4 @@ -// +build linux +// +build linux,!remote package system diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go index 94e456c52..75da38c0e 100644 --- a/pkg/specgen/container_validate.go +++ b/pkg/specgen/container_validate.go @@ -50,7 +50,8 @@ func (s *SpecGenerator) Validate() error { } // imagevolumemode must be one of ignore, tmpfs, or anonymous if given if len(s.ContainerStorageConfig.ImageVolumeMode) > 0 && !util.StringInSlice(strings.ToLower(s.ContainerStorageConfig.ImageVolumeMode), ImageVolumeModeValues) { - return errors.Errorf("ImageVolumeMode values must be one of %s", strings.Join(ImageVolumeModeValues, ",")) + return errors.Errorf("invalid ImageVolumeMode %q, value must be one of %s", + s.ContainerStorageConfig.ImageVolumeMode, strings.Join(ImageVolumeModeValues, ",")) } // shmsize conflicts with IPC namespace if s.ContainerStorageConfig.ShmSize != nil && !s.ContainerStorageConfig.IpcNS.IsPrivate() { diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index 9a073cde6..b16cff411 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -151,7 +151,6 @@ var _ = Describe("Podman images", func() { }) It("podman images filter reference", func() { - SkipIfRemote() podmanTest.RestoreAllArtifacts() result := podmanTest.PodmanNoCache([]string{"images", "-q", "-f", "reference=docker.io*"}) result.WaitWithDefaultTimeout() @@ -177,7 +176,6 @@ var _ = Describe("Podman images", func() { }) It("podman images filter before image", func() { - SkipIfRemote() dockerfile := `FROM docker.io/library/alpine:latest RUN apk update && apk add strace ` @@ -189,7 +187,6 @@ RUN apk update && apk add strace }) It("podman images filter after image", func() { - SkipIfRemote() podmanTest.RestoreAllArtifacts() rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"}) rmi.WaitWithDefaultTimeout() @@ -205,7 +202,6 @@ RUN apk update && apk add strace }) It("podman image list filter after image", func() { - SkipIfRemote() podmanTest.RestoreAllArtifacts() rmi := podmanTest.PodmanNoCache([]string{"image", "rm", "busybox"}) rmi.WaitWithDefaultTimeout() @@ -221,7 +217,6 @@ RUN apk update && apk add strace }) It("podman images filter dangling", func() { - SkipIfRemote() dockerfile := `FROM docker.io/library/alpine:latest ` podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false") @@ -233,9 +228,6 @@ RUN apk update && apk add strace }) It("podman check for image with sha256: prefix", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) @@ -248,9 +240,6 @@ RUN apk update && apk add strace }) It("podman check for image with sha256: prefix", func() { - if podmanTest.RemoteTest { - Skip("Does not work on remote client") - } session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE}) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) @@ -297,7 +286,6 @@ RUN apk update && apk add strace }) It("podman images --all flag", func() { - SkipIfRemote() podmanTest.RestoreAllArtifacts() dockerfile := `FROM docker.io/library/alpine:latest RUN mkdir hello @@ -317,7 +305,6 @@ ENV foo=bar }) It("podman images filter by label", func() { - SkipIfRemote() dockerfile := `FROM docker.io/library/alpine:latest LABEL version="1.0" LABEL "com.example.vendor"="Example Vendor" @@ -330,7 +317,6 @@ LABEL "com.example.vendor"="Example Vendor" }) It("podman with images with no layers", func() { - SkipIfRemote() dockerfile := strings.Join([]string{ `FROM scratch`, `LABEL org.opencontainers.image.authors="<somefolks@example.org>"`, @@ -395,7 +381,6 @@ LABEL "com.example.vendor"="Example Vendor" }) It("podman images --filter readonly", func() { - SkipIfRemote() dockerfile := `FROM docker.io/library/alpine:latest ` podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false") diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats index 36e9d57ec..f8c7f2766 100644 --- a/test/system/075-exec.bats +++ b/test/system/075-exec.bats @@ -50,6 +50,7 @@ load helpers } # Issue #4785 - piping to exec statement - fixed in #4818 +# Issue #5046 - piping to exec truncates results (actually a conmon issue) @test "podman exec - cat from stdin" { skip_if_remote @@ -60,6 +61,20 @@ load helpers run_podman exec -i $cid cat < <(echo $echo_string) is "$output" "$echo_string" "output read back from 'exec cat'" + # #5046 - large file content gets lost via exec + # Generate a large file with random content; get a hash of its content + local bigfile=${PODMAN_TMPDIR}/bigfile + dd if=/dev/urandom of=$bigfile bs=1024 count=1500 + expect=$(sha512sum $bigfile | awk '{print $1}') + # Transfer it to container, via exec, make sure correct #bytes are sent + run_podman exec -i $cid dd of=/tmp/bigfile bs=512 <$bigfile + is "${lines[0]}" "3000+0 records in" "dd: number of records in" + is "${lines[1]}" "3000+0 records out" "dd: number of records out" + # Verify sha. '% *' strips off the path, keeping only the SHA + run_podman exec $cid sha512sum /tmp/bigfile + is "${output% *}" "$expect" "SHA of file in container" + + # Clean up run_podman exec $cid touch /stop run_podman wait $cid run_podman rm $cid diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats index f34cd0707..0d14ca990 100644 --- a/test/system/200-pod.bats +++ b/test/system/200-pod.bats @@ -56,7 +56,11 @@ function teardown() { skip_if_remote "podman-pod does not work with podman-remote" 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 # Randomly-assigned port in the 5xxx range for port in $(shuf -i 5000-5999);do @@ -91,6 +95,10 @@ function teardown() { # ...then rm the pod, then rmi the pause image so we don't leave strays. run_podman pod rm $podname run_podman rmi $pause_iid + + # Pod no longer exists + run_podman 1 pod exists $podid + run_podman 1 pod exists $podname } # Random byte @@ -131,6 +139,9 @@ function random_ip() { hostname=$(random_string | tr A-Z a-z).$(random_string | tr A-Z a-z).net + labelname=$(random_string 11) + labelvalue=$(random_string 22) + pod_id_file=${PODMAN_TMPDIR}/pod-id-file # Create a pod with all the desired options @@ -143,7 +154,8 @@ function random_ip() { --add-host "$add_host_n:$add_host_ip" \ --dns "$dns_server" \ --dns-search "$dns_search" \ - --dns-opt "$dns_opt" + --dns-opt "$dns_opt" \ + --label "${labelname}=${labelvalue}" pod_id="$output" # Check --pod-id-file @@ -168,18 +180,20 @@ function random_ip() { is "$output" ".*nameserver $dns_server" "--dns [server] was added" is "$output" ".*search $dns_search" "--dns-search was added" is "$output" ".*options $dns_opt" "--dns-opt was added" -} -@test "podman pod inspect - format" { - skip_if_remote "podman-pod does not work with podman-remote" + # pod inspect + run_podman pod inspect --format '{{.Name}}: {{.ID}} : {{.NumContainers}} : {{.Labels}}' mypod + is "$output" "mypod: $pod_id : 1 : map\[${labelname}:${labelvalue}]" \ + "pod inspect --format ..." - run_podman pod create --name podtest - podid=$output + # pod ps + run_podman pod ps --format '{{.ID}} {{.Name}} {{.Status}} {{.Labels}}' + is "$output" "${pod_id:0:12} mypod Running map\[${labelname}:${labelvalue}]" "pod ps" - run_podman pod inspect --format '-> {{.Name}}: {{.NumContainers}}' podtest - is "$output" "-> podtest: 1" + run_podman pod ps --no-trunc --filter "label=${labelname}=${labelvalue}" --format '{{.ID}}' + is "$output" "$pod_id" "pod ps --filter label=..." - run_podman pod rm -f podtest + run_podman pod rm -f mypod } # vim: filetype=sh diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats index cd836610b..c9d1984d0 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -60,4 +60,27 @@ load helpers run_podman rmi busybox } +# Issue #5466 - port-forwarding doesn't work with this option and -d +@test "podman networking: port with --userns=keep-id" { + skip_if_remote + + # FIXME: randomize port, and create second random host port + myport=54321 + + # Container will exit as soon as 'nc' receives input + run_podman run -d --userns=keep-id -p 127.0.0.1:$myport:$myport \ + $IMAGE nc -l -p $myport + cid="$output" + + # emit random string, and check it + teststring=$(random_string 30) + echo "$teststring" | nc 127.0.0.1 $myport + + run_podman logs $cid + is "$output" "$teststring" "test string received on container" + + # Clean up + run_podman rm $cid +} + # vim: filetype=sh |