-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apiv2 /containers/json limit differ from docker-api #7739
apiv2 /containers/json limit differ from docker-api #7739
Conversation
7ece211
to
1e9ef7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to review and understand the main aspect of this, but ITM you need to fix the test.
test/apiv2/20-containers.at
Outdated
t GET containers/json?limit=0 200 \ | ||
.[0].Id~[0-9a-f]\\{64\\} | ||
|
||
t POST containers/${cid}/stop 204 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
Friendly amendment? Defer deletion of the previous container; this way we test a multi-container diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index d635702e4..60ebe2820 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -176,26 +176,27 @@ t GET containers/$cid/json 200 \
.Config.Cmd='[]' \
.Path="echo" \
.Args[0]="param1"
-t DELETE containers/$cid 204
# create a running container for after
t POST containers/create '"Image":"'$IMAGE'","Entrypoint":["top"]' 201 \
.Id~[0-9a-f]\\{64\\}
-cid=$(jq -r '.Id' <<<"$output")
-t GET containers/$cid/json 200 \
+cid_top=$(jq -r '.Id' <<<"$output")
+t GET containers/$cid_top/json 200 \
.Config.Entrypoint[0]="top" \
.Config.Cmd='[]' \
.Path="top"
-t POST containers/${cid}/start '' 204
+t POST containers/${cid_top}/start '' 204
# make sure the container is running
-t GET containers/$cid/json 200 \
+t GET containers/$cid_top/json 200 \
.State.Status="running"
# 0 means unlimited, need same with docker
-t GET containers/json?limit=0 200 \
- .[0].Id~[0-9a-f]\\{64\\}
+t GET 'containers/json?limit=0&all=1' 200 \
+ .[0].Id~[0-9a-f]\\{64\\} \
+ .[1].Id~[0-9a-f]\\{64\\}
-t POST containers/${cid}/stop 204
+t POST containers/${cid_top}/stop '' 204
+t DELETE containers/$cid_top 204
t DELETE containers/$cid 204
# vim: filetype=sh |
031d4a1
to
7075362
Compare
done |
7075362
to
3312ae1
Compare
LGTM |
// 0 means unlimited, need same with docker | ||
if query.Limit == 0 { | ||
query.Limit = -1 | ||
} | ||
if _, found := r.URL.Query()["limit"]; found && query.Limit != -1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking this over with more time, would it make more sense to change this line instead, to && query.Limit > 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
3312ae1
to
23f6142
Compare
Signed-off-by: zhangguanzhang <[email protected]>
23f6142
to
873989f
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, zhangguanzhang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes: #7722
Signed-off-by: zhangguanzhang [email protected]