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.py19
-rw-r--r--test/system/500-networking.bats22
2 files changed, 25 insertions, 16 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 5676ff65d..77674e81b 100644
--- a/test/apiv2/rest_api/test_rest_v2_0_0.py
+++ b/test/apiv2/rest_api/test_rest_v2_0_0.py
@@ -374,13 +374,13 @@ class TestApi(unittest.TestCase):
self.assertEqual(len(objs), 1)
def do_search3():
- payload = {'term': 'alpine', 'filters': {'is-official': True}}
+ payload = {'term': 'alpine', 'filters': '{"is-official":["true"]}'}
r = requests.get(url, params=payload, timeout=5)
self.assertEqual(r.status_code, 200, r.text)
objs = json.loads(r.text)
self.assertIn(type(objs), (list,))
-# TODO: Request should return only one item, but it returns more. For now this check is commented out.
-# self.assertEqual(len(objs), 1)
+ # There should be only one offical image
+ self.assertEqual(len(objs), 1)
def do_search4():
headers = {'X-Registry-Auth': 'null'}
@@ -401,19 +401,6 @@ class TestApi(unittest.TestCase):
search.join(timeout=10)
self.assertFalse(search.is_alive(), "/images/search took too long")
- def test_search_compat_with_(self):
- # Had issues with this test hanging when repositories not happy
- def do_search():
- r = requests.get(PODMAN_URL + "/v1.40/images/search?term=alpine", timeout=5)
- self.assertEqual(r.status_code, 200, r.text)
- objs = json.loads(r.text)
- self.assertIn(type(objs), (list,))
-
- search = Process(target=do_search)
- search.start()
- search.join(timeout=10)
- self.assertFalse(search.is_alive(), "/images/search took too long")
-
def test_ping(self):
required_headers = (
"API-Version",
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index bcc6737b7..0d976a6af 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -98,6 +98,7 @@ 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)
local mysubnet=$(random_rfc1918_subnet)
@@ -115,6 +116,27 @@ load helpers
is "$output" ".* inet ${mysubnet}\.2/24 brd ${mysubnet}\.255 " \
"sdfsdf"
+ run_podman run --rm -d --network $mynetname -p 127.0.0.1:$myport:$myport \
+ $IMAGE nc -l -n -v -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
+ # Sigh. We can't check line-by-line, because 'nc' output order is
+ # unreliable. We usually get the 'connect to' line before the random
+ # string, but sometimes we get it after. So, just do substring checks.
+ is "$output" ".*listening on \[::\]:$myport .*" "nc -v shows right port"
+
+ # This is the truly important check: make sure the remote IP is
+ # in the 172.X range, not 127.X.
+ is "$output" \
+ ".*connect to \[::ffff:172\..*\]:$myport from \[::ffff:172\..*\]:.*" \
+ "nc -v shows remote IP address in 172.X space (not 127.0.0.1)"
+ is "$output" ".*${teststring}.*" "test string received on container"
+
# Cannot create network with the same name
run_podman 125 network create $mynetname
is "$output" "Error: the network name $mynetname is already used" \