diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/python/rest_api/test_v2_0_0_container.py | 13 | ||||
-rw-r--r-- | test/compose/uptwice/Dockerfile | 2 | ||||
-rw-r--r-- | test/compose/uptwice/docker-compose.yml | 5 | ||||
-rw-r--r-- | test/compose/uptwice/tests.sh | 4 | ||||
-rw-r--r-- | test/e2e/manifest_test.go | 6 | ||||
-rw-r--r-- | test/e2e/pod_ps_test.go | 8 | ||||
-rw-r--r-- | test/python/docker/compat/test_containers.py | 14 | ||||
-rw-r--r-- | test/system/070-build.bats | 34 |
8 files changed, 86 insertions, 0 deletions
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_container.py b/test/apiv2/python/rest_api/test_v2_0_0_container.py index 2fab4aeb9..f252bd401 100644 --- a/test/apiv2/python/rest_api/test_v2_0_0_container.py +++ b/test/apiv2/python/rest_api/test_v2_0_0_container.py @@ -1,5 +1,6 @@ import random import unittest +import json import requests from dateutil.parser import parse @@ -97,6 +98,18 @@ class ContainerTestCase(APITestCase): def test_logs(self): r = requests.get(self.uri(self.resolve_container("/containers/{}/logs?stdout=true"))) self.assertEqual(r.status_code, 200, r.text) + r = requests.post( + self.podman_url + "/v1.40/containers/create?name=topcontainer", + json={"Cmd": ["top", "ls"], "Image": "alpine:latest"}, + ) + self.assertEqual(r.status_code, 201, r.text) + payload = r.json() + container_id = payload["Id"] + self.assertIsNotNone(container_id) + r = requests.get(self.podman_url + f"/v1.40/containers/{payload['Id']}/logs?follow=false&stdout=true&until=0") + self.assertEqual(r.status_code, 200, r.text) + r = requests.get(self.podman_url + f"/v1.40/containers/{payload['Id']}/logs?follow=false&stdout=true&until=1") + self.assertEqual(r.status_code, 200, r.text) def test_commit(self): r = requests.post(self.uri(self.resolve_container("/commit?container={}"))) diff --git a/test/compose/uptwice/Dockerfile b/test/compose/uptwice/Dockerfile new file mode 100644 index 000000000..b993af04d --- /dev/null +++ b/test/compose/uptwice/Dockerfile @@ -0,0 +1,2 @@ +FROM alpine +WORKDIR /app diff --git a/test/compose/uptwice/docker-compose.yml b/test/compose/uptwice/docker-compose.yml new file mode 100644 index 000000000..e06f9e554 --- /dev/null +++ b/test/compose/uptwice/docker-compose.yml @@ -0,0 +1,5 @@ +version: '3' +services: + app: + build: . + command: sleep 10002 diff --git a/test/compose/uptwice/tests.sh b/test/compose/uptwice/tests.sh new file mode 100644 index 000000000..291694d83 --- /dev/null +++ b/test/compose/uptwice/tests.sh @@ -0,0 +1,4 @@ +# -*- bash -*- + +sed -i -e 's/10001/10002/' docker-compose.yml +docker-compose up -d diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index b2dc4f734..8c1ea4134 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -50,6 +50,12 @@ var _ = Describe("Podman manifest", func() { Expect(session.ExitCode()).To(Equal(0)) }) + It("podman manifest create", func() { + session := podmanTest.Podman([]string{"manifest", "create", "foo", imageList}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + }) + It("podman manifest inspect", func() { session := podmanTest.Podman([]string{"manifest", "inspect", BB}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index c5c0827bc..28477d886 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -370,4 +370,12 @@ var _ = Describe("Podman ps", func() { Expect(session.ExitCode()).To(Equal(0)) Expect(session.OutputToString()).To(ContainSubstring("value1")) }) + + It("podman pod ps headers", func() { + session := podmanTest.Podman([]string{"pod", "ps", "--ctr-ids", "--ctr-names", "--ctr-status", "--ns"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(MatchRegexp(`^POD ID\s+NAME\s+STATUS\s+CREATED\s+INFRA ID\s+IDS\s+NAMES\s+STATUS\s+CGROUP\s+NAMESPACES$`)) + }) + }) diff --git a/test/python/docker/compat/test_containers.py b/test/python/docker/compat/test_containers.py index 511ab1451..38ac5b59f 100644 --- a/test/python/docker/compat/test_containers.py +++ b/test/python/docker/compat/test_containers.py @@ -7,6 +7,7 @@ from typing import IO, Optional from docker import DockerClient, errors from docker.models.containers import Container +from docker.models.images import Image from test.python.docker import Podman from test.python.docker.compat import common, constant @@ -237,3 +238,16 @@ class TestContainers(unittest.TestCase): if ctr is not None: ctr.stop() ctr.remove() + + def test_mount_preexisting_dir(self): + dockerfile = (B'FROM quay.io/libpod/alpine:latest\n' + B'USER root\n' + B'RUN mkdir -p /workspace\n' + B'RUN chown 1042:1043 /workspace') + img: Image + img, out = self.client.images.build(fileobj=io.BytesIO(dockerfile)) + ctr: Container = self.client.containers.create(image=img.id, detach=True, command="top", + volumes=["test_mount_preexisting_dir_vol:/workspace"]) + ctr.start() + ret, out = ctr.exec_run(["stat", "-c", "%u:%g", "/workspace"]) + self.assertTrue(out.startswith(b'1042:1043'), "assert correct uid/gid") diff --git a/test/system/070-build.bats b/test/system/070-build.bats index c45a661fe..7046625c6 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -509,6 +509,40 @@ EOF done } +# Regression test for #9867 +# Make sure that if you exclude everything in context dir, that +# the Containerfile/Dockerfile in the context dir are used +@test "podman build with ignore '*'" { + local tmpdir=$PODMAN_TMPDIR/build-test-$(random_string 10) + mkdir -p $tmpdir + + cat >$tmpdir/Containerfile <<EOF +FROM scratch +EOF + +cat >$tmpdir/.dockerignore <<EOF +* +EOF + + run_podman build -t build_test $tmpdir + + # Rename Containerfile to Dockerfile + mv $tmpdir/Containerfile $tmpdir/Dockerfile + + run_podman build -t build_test $tmpdir + + # Rename Dockerfile to foofile + mv $tmpdir/Dockerfile $tmpdir/foofile + + run_podman 125 build -t build_test $tmpdir + is "$output" ".*Dockerfile: no such file or directory" + + run_podman build -t build_test -f $tmpdir/foofile $tmpdir + + # Clean up + run_podman rmi -f build_test +} + @test "podman build - stdin test" { # Random workdir, and random string to verify build output workdir=/$(random_string 10) |