summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/20-containers.at26
-rw-r--r--test/python/docker/compat/test_images.py17
-rw-r--r--test/system/120-load.bats9
-rw-r--r--test/system/200-pod.bats16
-rw-r--r--test/system/220-healthcheck.bats2
-rw-r--r--test/system/410-selinux.bats3
-rw-r--r--test/system/500-networking.bats1
7 files changed, 46 insertions, 28 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 478717700..9030f0095 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -280,6 +280,32 @@ t GET containers/json 200 \
podman stop bar
+#compat api list containers sanity checks
+t GET containers/json?filters='garb1age}' 500 \
+ .cause="invalid character 'g' looking for beginning of value"
+t GET containers/json?filters='{"label":["testl' 500 \
+ .cause="unexpected end of JSON input"
+
+#libpod api list containers sanity checks
+t GET libpod/containers/json?filters='garb1age}' 500 \
+ .cause="invalid character 'g' looking for beginning of value"
+t GET libpod/containers/json?filters='{"label":["testl' 500 \
+ .cause="unexpected end of JSON input"
+
+# Prune containers - bad filter input
+t POST containers/prune?filters='garb1age}' 500 \
+ .cause="invalid character 'g' looking for beginning of value"
+t POST libpod/containers/prune?filters='garb1age}' 500 \
+ .cause="invalid character 'g' looking for beginning of value"
+
+## Prune containers with illformed label
+t POST containers/prune?filters='{"label":["tes' 500 \
+ .cause="unexpected end of JSON input"
+t POST libpod/containers/prune?filters='{"label":["tes' 500 \
+ .cause="unexpected end of JSON input"
+
+t GET libpod/containers/json?filters='{"label":["testlabel"]}' 200 length=0
+
# Test CPU limit (NanoCPUs)
t POST containers/create Image=$IMAGE HostConfig='{"NanoCpus":500000}' 201 \
.Id~[0-9a-f]\\{64\\}
diff --git a/test/python/docker/compat/test_images.py b/test/python/docker/compat/test_images.py
index 4a90069a9..571b31881 100644
--- a/test/python/docker/compat/test_images.py
+++ b/test/python/docker/compat/test_images.py
@@ -1,4 +1,5 @@
import collections
+import io
import os
import subprocess
import sys
@@ -6,6 +7,7 @@ import time
import unittest
from docker import DockerClient, errors
+from docker.errors import APIError
from test.python.docker import Podman
from test.python.docker.compat import common, constant
@@ -79,9 +81,7 @@ class TestImages(unittest.TestCase):
self.assertEqual(len(self.client.images.list()), 2)
# List images with filter
- self.assertEqual(
- len(self.client.images.list(filters={"reference": "alpine"})), 1
- )
+ self.assertEqual(len(self.client.images.list(filters={"reference": "alpine"})), 1)
def test_search_image(self):
"""Search for image"""
@@ -149,15 +149,22 @@ class TestImages(unittest.TestCase):
self.assertEqual(len(self.client.images.list()), 2)
+ def test_load_corrupt_image(self):
+ """Import|Load Image failure"""
+ tarball = io.BytesIO("This is a corrupt tarball".encode("utf-8"))
+ with self.assertRaises(APIError):
+ self.client.images.load(tarball)
+
def test_build_image(self):
labels = {"apple": "red", "grape": "green"}
- _ = self.client.images.build(path="test/python/docker/build_labels", labels=labels, tag="labels")
+ _ = self.client.images.build(
+ path="test/python/docker/build_labels", labels=labels, tag="labels"
+ )
image = self.client.images.get("labels")
self.assertEqual(image.labels["apple"], labels["apple"])
self.assertEqual(image.labels["grape"], labels["grape"])
-
if __name__ == "__main__":
# Setup temporary space
unittest.main()
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index 95113c4a6..d29be462d 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -32,7 +32,7 @@ verify_iid_and_name() {
echo "I am an invalid file and should cause a podman-load error" > $invalid
run_podman 125 load -i $invalid
# podman and podman-remote emit different messages; this is a common string
- is "$output" ".*error pulling image: unable to pull .*" \
+ is "$output" ".*payload does not match any of the supported image formats .*" \
"load -i INVALID fails with expected diagnostic"
}
@@ -137,6 +137,13 @@ verify_iid_and_name() {
"Diagnostic from 'podman load' without redirection or -i"
}
+@test "podman load - redirect corrupt payload" {
+ run_podman 125 load <<< "Danger, Will Robinson!! This is a corrupt tarball!"
+ is "$output" \
+ ".*payload does not match any of the supported image formats .*" \
+ "Diagnostic from 'podman load' unknown/corrupt payload"
+}
+
@test "podman load - multi-image archive" {
img1="quay.io/libpod/testimage:00000000"
img2="quay.io/libpod/testimage:20200902"
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 51835e4a3..c65449212 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -18,10 +18,6 @@ function teardown() {
@test "podman pod top - containers in different PID namespaces" {
- if is_remote && is_rootless; then
- skip "FIXME: pending #7139"
- fi
-
# With infra=false, we don't get a /pause container (we also
# don't pull k8s.gcr.io/pause )
no_infra='--infra=false'
@@ -55,10 +51,6 @@ function teardown() {
@test "podman pod - communicating between pods" {
- if is_remote && is_rootless; then
- skip "FIXME: pending #7139"
- fi
-
podname=pod$(random_string)
run_podman 1 pod exists $podname
run_podman pod create --infra=true --name=$podname
@@ -117,10 +109,6 @@ function teardown() {
}
@test "podman pod - communicating via /dev/shm " {
- if is_remote && is_rootless; then
- skip "FIXME: pending #7139"
- fi
-
podname=pod$(random_string)
run_podman 1 pod exists $podname
run_podman pod create --infra=true --name=$podname
@@ -168,10 +156,6 @@ function random_ip() {
}
@test "podman pod create - hashtag AllTheOptions" {
- if is_remote && is_rootless; then
- skip "FIXME: pending #7139"
- fi
-
mac=$(random_mac)
add_host_ip=$(random_ip)
add_host_n=$(random_string | tr A-Z a-z).$(random_string | tr A-Z a-z).xyz
diff --git a/test/system/220-healthcheck.bats b/test/system/220-healthcheck.bats
index 3405029c1..f929c6770 100644
--- a/test/system/220-healthcheck.bats
+++ b/test/system/220-healthcheck.bats
@@ -25,8 +25,6 @@ function _check_health {
@test "podman healthcheck" {
- skip_if_remote "FIXME: pending #7137"
-
# Create an image with a healthcheck script; said script will
# pass until the file /uh-oh gets created (by us, via exec)
cat >${PODMAN_TMPDIR}/healthcheck <<EOF
diff --git a/test/system/410-selinux.bats b/test/system/410-selinux.bats
index 49743ff33..4a2c7b7a4 100644
--- a/test/system/410-selinux.bats
+++ b/test/system/410-selinux.bats
@@ -61,9 +61,6 @@ function check_label() {
# SELinux not enabled on Ubuntu, so we should never get here
die "WHOA! SELinux enabled, but no /usr/bin/rpm!"
fi
- if [[ "$cs_version" < "2.146" ]]; then
- skip "FIXME: #7939: requires container-selinux-2.146.0 (currently installed: $cs_version)"
- fi
fi
# FIXME FIXME FIXME: delete up to here, leaving just check_label
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index 0d976a6af..4868ad6a0 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -97,7 +97,6 @@ load helpers
# "network create" now works rootless, with the help of a special container
@test "podman network create" {
- skip_if_remote "FIXME: pending #7808"
myport=54322
local mynetname=testnet-$(random_string 10)