diff options
author | Jhon Honce <jhonce@redhat.com> | 2020-07-30 08:16:14 -0700 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-08-11 13:53:23 +0200 |
commit | 1752851958145f65e50cef5fab3e114487fcb63a (patch) | |
tree | e3609ced345f34cb4683dd7ef98cf18b82354a73 /test | |
parent | d0b6e258bfcd2c15d8954aeae38e630b49c8f803 (diff) | |
download | podman-1752851958145f65e50cef5fab3e114487fcb63a.tar.gz podman-1752851958145f65e50cef5fab3e114487fcb63a.tar.bz2 podman-1752851958145f65e50cef5fab3e114487fcb63a.zip |
Add versioned _ping endpoint
Fixes #7008
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/01-basic.at | 8 | ||||
-rw-r--r-- | test/apiv2/rest_api/test_rest_v1_0_0.py | 21 |
2 files changed, 25 insertions, 4 deletions
diff --git a/test/apiv2/01-basic.at b/test/apiv2/01-basic.at index 79dac990a..96b6aef7c 100644 --- a/test/apiv2/01-basic.at +++ b/test/apiv2/01-basic.at @@ -5,9 +5,15 @@ # NOTE: paths with a leading slash will be interpreted as-is; # paths without will have '/v1.40/' prepended. -t GET /_ping 200 OK +t GET /_ping 200 OK t HEAD /_ping 200 t GET /libpod/_ping 200 OK +t HEAD /libpod/_ping 200 + +t GET _ping 200 OK +t HEAD _ping 200 +t GET libpod/_ping 200 OK +t HEAD libpod/_ping 200 for i in /version version; do t GET $i 200 \ diff --git a/test/apiv2/rest_api/test_rest_v1_0_0.py b/test/apiv2/rest_api/test_rest_v1_0_0.py index 7c53623cb..2e574e015 100644 --- a/test/apiv2/rest_api/test_rest_v1_0_0.py +++ b/test/apiv2/rest_api/test_rest_v1_0_0.py @@ -13,9 +13,11 @@ from multiprocessing import Process import requests from dateutil.parser import parse +PODMAN_URL = "http://localhost:8080" + def _url(path): - return "http://localhost:8080/v1.0.0/libpod" + path + return PODMAN_URL + "/v1.0.0/libpod" + path def podman(): @@ -205,7 +207,21 @@ class TestApi(unittest.TestCase): search.join(timeout=10) self.assertFalse(search.is_alive(), "/images/search took too long") - def validateObjectFields(self, buffer): + def test_ping(self): + r = requests.get(PODMAN_URL + "/_ping") + self.assertEqual(r.status_code, 200, r.text) + + r = requests.head(PODMAN_URL + "/_ping") + self.assertEqual(r.status_code, 200, r.text) + + r = requests.get(_url("/_ping")) + self.assertEqual(r.status_code, 200, r.text) + + r = requests.get(_url("/_ping")) + self.assertEqual(r.status_code, 200, r.text) + + +def validateObjectFields(self, buffer): objs = json.loads(buffer) if not isinstance(objs, dict): for o in objs: @@ -214,6 +230,5 @@ class TestApi(unittest.TestCase): _ = objs["Id"] return objs - if __name__ == '__main__': unittest.main() |