mirror of https://github.com/docker/docs.git
Merge pull request #1945 from jimmyxian/add-support-ps-node-filter
Add support ps node filter
This commit is contained in:
commit
63997816a5
|
|
@ -378,6 +378,9 @@ func getContainersJSON(c *context, w http.ResponseWriter, r *http.Request) {
|
|||
if !filters.Match("status", container.Info.State.StateString()) {
|
||||
continue
|
||||
}
|
||||
if !filters.Match("node", container.Engine.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
if len(filtExited) > 0 {
|
||||
shouldSkip := true
|
||||
|
|
|
|||
|
|
@ -144,3 +144,16 @@ function teardown() {
|
|||
[[ "$output" == *"$secondID"* ]]
|
||||
[[ "$output" != *"$thirdID"* ]]
|
||||
}
|
||||
|
||||
@test "docker ps --filter node" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
docker_swarm run --name c1 -e constraint:node==node-0 -d busybox:latest sleep 100
|
||||
docker_swarm run --name c2 -e constraint:node==node-1 -d busybox:latest sleep 100
|
||||
|
||||
run docker_swarm ps --filter node=node-0
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${output}" == *"node-0/c1"* ]]
|
||||
[[ "${output}" != *"node-1/c2"* ]]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue