summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/rest_api/test_rest_v2_0_0.py4
-rwxr-xr-xtest/compose/test-compose23
-rw-r--r--test/system/420-cgroups.bats5
-rw-r--r--test/system/helpers.bash15
4 files changed, 37 insertions, 10 deletions
diff --git a/test/apiv2/rest_api/test_rest_v2_0_0.py b/test/apiv2/rest_api/test_rest_v2_0_0.py
index e3874c182..bf0ee0603 100644
--- a/test/apiv2/rest_api/test_rest_v2_0_0.py
+++ b/test/apiv2/rest_api/test_rest_v2_0_0.py
@@ -727,6 +727,10 @@ class TestApi(unittest.TestCase):
start = json.loads(r.text)
self.assertGreater(len(start["Errs"]), 0, r.text)
+ def test_manifest_409(self):
+ r = requests.post(_url("/manifests/create"), params={"name": "ThisIsAnInvalidImage"})
+ self.assertEqual(r.status_code, 400, r.text)
+
def test_df(self):
r = requests.get(_url("/system/df"))
self.assertEqual(r.status_code, 200, r.text)
diff --git a/test/compose/test-compose b/test/compose/test-compose
index 7693041ac..abb957b43 100755
--- a/test/compose/test-compose
+++ b/test/compose/test-compose
@@ -163,18 +163,21 @@ function test_port() {
local op="$2" # '=' or '~'
local expect="$3" # what to expect from curl output
- local actual=$(curl --retry 3 --retry-all-errors -s http://127.0.0.1:$port/)
- # The test is flaking with an empty result. The curl retry doesn't solve this.
- # If the result is empty sleep one second and try again.
- if [[ "$actual" == "" ]]; then
+ # -s -S means "silent, but show errors"
+ local actual=$(curl --retry 3 --retry-all-errors -s -S http://127.0.0.1:$port/)
+ local curl_rc=$?
+
+ # FIXME 2021-04-13: test is flaking, curl succeeds but returns empty result.
+ # Could it be that the container is not actually ready? Wait, and retry.
+ if [[ $curl_rc -eq 0 && -z "$actual" ]]; then
sleep 1
- local actual=$(curl --retry 3 --retry-all-errors -s http://127.0.0.1:$port/)
+ echo "# Retrying curl:"
+ actual=$(curl --retry 3 --retry-all-errors -s -S http://127.0.0.1:$port/)
+ curl_rc=$?
fi
- local curl_rc=$?
+
if [ $curl_rc -ne 0 ]; then
_show_ok 0 "$testname - curl failed with status $curl_rc"
-### docker-compose down >>$logfile 2>&1
-### exit 1
fi
case "$op" in
@@ -285,6 +288,10 @@ fi
# Too hard to precompute the number of tests; just spit it out at the end.
n_tests=0
+
+# We aren't really TAP 13; this helps logformatter recognize our output as BATS
+echo "TAP version 13"
+
for t in ${tests_to_run[@]}; do
testdir="$(dirname $t)"
testname="$(basename $testdir)"
diff --git a/test/system/420-cgroups.bats b/test/system/420-cgroups.bats
index 615e43e6c..89c81a742 100644
--- a/test/system/420-cgroups.bats
+++ b/test/system/420-cgroups.bats
@@ -24,6 +24,11 @@ load helpers
run_podman container inspect --format '{{.HostConfig.CgroupManager}}' myc
is "$output" "$other" "podman preserved .HostConfig.CgroupManager"
+ if is_rootless && test $other = cgroupfs ; then
+ run_podman container inspect --format '{{.HostConfig.CgroupParent}}' myc
+ is "$output" "" "podman didn't set .HostConfig.CgroupParent for cgroupfs and rootless"
+ fi
+
# Restart the container, without --cgroup-manager option (ie use default)
# Prior to #7970, this would fail with an OCI runtime error
run_podman start myc
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 823dc3376..b9eacfd0b 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -9,6 +9,7 @@ PODMAN_TEST_IMAGE_USER=${PODMAN_TEST_IMAGE_USER:-"libpod"}
PODMAN_TEST_IMAGE_NAME=${PODMAN_TEST_IMAGE_NAME:-"testimage"}
PODMAN_TEST_IMAGE_TAG=${PODMAN_TEST_IMAGE_TAG:-"20210223"}
PODMAN_TEST_IMAGE_FQN="$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG"
+PODMAN_TEST_IMAGE_ID=
# Remote image that we *DO NOT* fetch or keep by default; used for testing pull
# This changed from 0 to 1 on 2021-02-24 due to multiarch considerations; it
@@ -53,11 +54,21 @@ function basic_setup() {
for line in "${lines[@]}"; do
set $line
if [ "$1" == "$PODMAN_TEST_IMAGE_FQN" ]; then
+ if [[ -z "$PODMAN_TEST_IMAGE_ID" ]]; then
+ # This will probably only trigger the 2nd time through setup
+ PODMAN_TEST_IMAGE_ID=$2
+ fi
found_needed_image=1
else
- echo "# setup(): removing stray images $1 $2" >&3
+ # Always remove image that doesn't match by name
+ echo "# setup(): removing stray image $1" >&3
run_podman rmi --force "$1" >/dev/null 2>&1 || true
- run_podman rmi --force "$2" >/dev/null 2>&1 || true
+
+ # Tagged image will have same IID as our test image; don't rmi it.
+ if [[ $2 != "$PODMAN_TEST_IMAGE_ID" ]]; then
+ echo "# setup(): removing stray image $2" >&3
+ run_podman rmi --force "$2" >/dev/null 2>&1 || true
+ fi
fi
done