summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-23 14:45:29 -0400
committerGitHub <noreply@github.com>2021-06-23 14:45:29 -0400
commitb0a3ac35785fca1a054d236937c86cce85631585 (patch)
treec9b5b8a72cb57ddbfb49a463564468c24f23b637 /test
parent2b850ef055885bf3482f405e804fb02aef2e9895 (diff)
parent6ecdf4c389fd8e079fbfae76c11351c0301eb003 (diff)
downloadpodman-b0a3ac35785fca1a054d236937c86cce85631585.tar.gz
podman-b0a3ac35785fca1a054d236937c86cce85631585.tar.bz2
podman-b0a3ac35785fca1a054d236937c86cce85631585.zip
Merge pull request #10610 from cdoern/healthCheck
Edited compat handling code for containers/json status and added python tests
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py23
1 files changed, 23 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 b4b3af2df..2fab4aeb9 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
@@ -14,6 +14,13 @@ class ContainerTestCase(APITestCase):
obj = r.json()
self.assertEqual(len(obj), 1)
+ def test_list_filters(self):
+ r = requests.get(self.podman_url + "/v1.40/containers/json?filters%3D%7B%22status%22%3A%5B%22running%22%5D%7D")
+ self.assertEqual(r.status_code, 200, r.text)
+ payload = r.json()
+ containerAmnt = len(payload)
+ self.assertGreater(containerAmnt, 0)
+
def test_list_all(self):
r = requests.get(self.uri("/containers/json?all=true"))
self.assertEqual(r.status_code, 200, r.text)
@@ -25,6 +32,22 @@ class ContainerTestCase(APITestCase):
self.assertId(r.content)
_ = parse(r.json()["Created"])
+ r = requests.post(
+ self.podman_url + "/v1.40/containers/create?name=topcontainer",
+ json={"Cmd": ["top"], "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']}/json")
+ self.assertEqual(r.status_code, 200, r.text)
+ self.assertId(r.content)
+ out = r.json()
+ state = out["State"]["Health"]
+ self.assertIsInstance(state, dict)
+
def test_stats(self):
r = requests.get(self.uri(self.resolve_container("/containers/{}/stats?stream=false")))
self.assertIn(r.status_code, (200, 409), r.text)