mirror of https://github.com/docker/docs.git
Merge pull request #16403 from runcom/fix-containers-json-emtpy-response
Fix GET /containers/json emtpy response regression
This commit is contained in:
commit
96f9efc063
|
@ -84,7 +84,7 @@ func (daemon *Daemon) Containers(config *ContainersConfig) ([]*types.Container,
|
|||
|
||||
// reduceContainer parses the user filtering and generates the list of containers to return based on a reducer.
|
||||
func (daemon *Daemon) reduceContainers(config *ContainersConfig, reducer containerReducer) ([]*types.Container, error) {
|
||||
var containers []*types.Container
|
||||
containers := []*types.Container{}
|
||||
|
||||
ctx, err := daemon.foldFilter(config)
|
||||
if err != nil {
|
||||
|
|
|
@ -1514,3 +1514,14 @@ func (s *DockerSuite) TestPutContainerArchiveErrSymlinkInVolumeToReadOnlyRootfs(
|
|||
c.Fatalf("expected ErrContainerRootfsReadonly error, but got %d: %s", statusCode, string(body))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestContainersApiGetContainersJSONEmpty(c *check.C) {
|
||||
testRequires(c, DaemonIsLinux)
|
||||
|
||||
status, body, err := sockRequest("GET", "/containers/json?all=1", nil)
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(status, check.Equals, http.StatusOK)
|
||||
if string(body) != "[]\n" {
|
||||
c.Fatalf("Expected empty response to be `[]`, got %q", string(body))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue