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/system/070-build.bats | 34 |
2 files changed, 47 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/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) |