mirror of
https://github.com/moby/moby.git
synced 2025-08-07 02:02:57 +03:00
28722: List of containers with networkID filter is not working
Signed-off-by: dattatrayakumbhar04 <dattatraya.kumbhar@gslab.com>
This commit is contained in:
committed by
Dattatraya Kumbhar
parent
05cd8bec32
commit
59b70cdabe
@@ -504,7 +504,7 @@ func includeContainerInList(container *container.Container, ctx *listContext) it
|
|||||||
if nw.EndpointSettings == nil {
|
if nw.EndpointSettings == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if nw.NetworkID == value {
|
if strings.HasPrefix(nw.NetworkID, value) {
|
||||||
return networkExist
|
return networkExist
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -877,6 +877,23 @@ func (s *DockerSuite) TestPsListContainersFilterNetwork(c *check.C) {
|
|||||||
containerOut = strings.TrimSpace(string(out))
|
containerOut = strings.TrimSpace(string(out))
|
||||||
|
|
||||||
c.Assert(containerOut, checker.Contains, "onbridgenetwork")
|
c.Assert(containerOut, checker.Contains, "onbridgenetwork")
|
||||||
|
|
||||||
|
// Filter by partial network ID
|
||||||
|
partialnwID := string(nwID[0:4])
|
||||||
|
|
||||||
|
out, _ = dockerCmd(c, "ps", "--filter", "network="+partialnwID)
|
||||||
|
containerOut = strings.TrimSpace(string(out))
|
||||||
|
|
||||||
|
lines = strings.Split(containerOut, "\n")
|
||||||
|
// skip header
|
||||||
|
lines = lines[1:]
|
||||||
|
|
||||||
|
// ps output should have only one container
|
||||||
|
c.Assert(lines, checker.HasLen, 1)
|
||||||
|
|
||||||
|
// Making sure onbridgenetwork is on the output
|
||||||
|
c.Assert(containerOut, checker.Contains, "onbridgenetwork", check.Commentf("Missing the container on network\n"))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DockerSuite) TestPsByOrder(c *check.C) {
|
func (s *DockerSuite) TestPsByOrder(c *check.C) {
|
||||||
|
Reference in New Issue
Block a user