mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
client: container ps: don't set "limit" if none was set
both -1 and 0 are accepted as "no limit", so don't send the limit option if no limit was set. For simplicity, we're ignoring values <= 0. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
88e1fec490
commit
890231f46b
2 changed files with 4 additions and 4 deletions
|
@ -18,7 +18,7 @@ func (cli *Client) ContainerList(ctx context.Context, options types.ContainerLis
|
|||
query.Set("all", "1")
|
||||
}
|
||||
|
||||
if options.Limit != -1 {
|
||||
if options.Limit > 0 {
|
||||
query.Set("limit", strconv.Itoa(options.Limit))
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ func TestContainerList(t *testing.T) {
|
|||
return nil, fmt.Errorf("all not set in URL query properly. Expected '1', got %s", all)
|
||||
}
|
||||
limit := query.Get("limit")
|
||||
if limit != "0" {
|
||||
return nil, fmt.Errorf("limit should have not be present in query. Expected '0', got %s", limit)
|
||||
if limit != "" {
|
||||
return nil, fmt.Errorf("limit should have not be present in query, got %s", limit)
|
||||
}
|
||||
since := query.Get("since")
|
||||
if since != "container" {
|
||||
|
@ -48,7 +48,7 @@ func TestContainerList(t *testing.T) {
|
|||
}
|
||||
before := query.Get("before")
|
||||
if before != "" {
|
||||
return nil, fmt.Errorf("before should have not be present in query, go %s", before)
|
||||
return nil, fmt.Errorf("before should have not be present in query, got %s", before)
|
||||
}
|
||||
size := query.Get("size")
|
||||
if size != "1" {
|
||||
|
|
Loading…
Reference in a new issue