summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/api/handlers/types.go2
-rw-r--r--pkg/api/handlers/utils/containers.go15
-rw-r--r--test/apiv2/26-containersWait.at4
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py2
4 files changed, 13 insertions, 10 deletions
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index 52d7633af..2ffd9b0cb 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -98,7 +98,7 @@ type BuildResult struct {
type ContainerWaitOKBody struct {
StatusCode int
- Error struct {
+ Error *struct {
Message string
}
}
diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go
index 6c708f74e..fb1f8b7c1 100644
--- a/pkg/api/handlers/utils/containers.go
+++ b/pkg/api/handlers/utils/containers.go
@@ -75,18 +75,19 @@ func WaitContainerDocker(w http.ResponseWriter, r *http.Request) {
}
exitCode, err := waitDockerCondition(ctx, name, interval, condition)
- msg := ""
+ var errStruct *struct{ Message string }
if err != nil {
logrus.Errorf("error while waiting on condition: %q", err)
- msg = err.Error()
+ errStruct = &struct {
+ Message string
+ }{
+ Message: err.Error(),
+ }
}
+
responseData := handlers.ContainerWaitOKBody{
StatusCode: int(exitCode),
- Error: struct {
- Message string
- }{
- Message: msg,
- },
+ Error: errStruct,
}
enc := json.NewEncoder(w)
enc.SetEscapeHTML(true)
diff --git a/test/apiv2/26-containersWait.at b/test/apiv2/26-containersWait.at
index ec16c35df..55bcd4592 100644
--- a/test/apiv2/26-containersWait.at
+++ b/test/apiv2/26-containersWait.at
@@ -21,7 +21,9 @@ t POST "containers/${CTR}/wait?condition=non-existent-cond" 400
t POST "containers/${CTR}/wait?condition=not-running" 200
-t POST "containers/${CTR}/wait?condition=next-exit" 200 &
+t POST "containers/${CTR}/wait?condition=next-exit" 200 \
+ .StatusCode=0 \
+ .Error=null &
child_pid=$!
podman start "${CTR}"
wait "${child_pid}"
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 70c07d47f..ad096ed38 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
@@ -99,7 +99,7 @@ class ContainerTestCase(APITestCase):
r = requests.post(self.podman_url + f"/v1.40/containers/{create['Id']}/wait")
self.assertEqual(r.status_code, 200, r.text)
wait = r.json()
- self.assertEqual(wait["StatusCode"], 0, wait["Error"]["Message"])
+ self.assertEqual(wait["StatusCode"], 0, wait["Error"])
prune = requests.post(self.podman_url + "/v1.40/containers/prune")
self.assertEqual(prune.status_code, 200, prune.status_code)