Files
docker-docs/test/integration/cli/ls.bats
Eric Sage b333ea5294 Add regex based name filter to ls command.
Signed-off-by: Eric Sage <eric.david.sage@gmail.com>

Add regex support

Signed-off-by: Eric Sage <eric.david.sage@gmail.com>

Allow bad regex passthrough to reg string amtch

Signed-off-by: Eric Sage <eric.david.sage@gmail.com>

Add unit test

Signed-off-by: Eric Sage <eric.david.sage@gmail.com>

Add integration tests

Signed-off-by: Eric Sage <eric.david.sage@gmail.com>

Add documentation for name filter.

Signed-off-by: Eric Sage <eric.david.sage@gmail.com>
2015-07-22 21:06:26 -04:00

40 lines
1.2 KiB
Bash

#!/usr/bin/env bats
load ${BASE_TEST_DIR}/helpers.bash
teardown () {
machine rm testmachine
}
@test "ls: filter on driver" {
run machine create -d none --url tcp://127.0.0.1:2375 testmachine
run machine ls --filter driver=none
[ "$status" -eq 0 ]
[[ ${lines[1]} =~ "testmachine" ]]
}
@test "ls: filter on swarm" {
run machine create -d none --url tcp://127.0.0.1:2375 --swarm --swarm-master --swarm-discovery token://deadbeef testmachine
run machine ls --filter swarm=testmachine
[ "$status" -eq 0 ]
[[ ${lines[1]} =~ "testmachine" ]]
}
@test "ls: filter on name" {
run mchine create -d none -url tcp://127.0.0.1:2375 testmachine
run mchine create -d none -url tcp://127.0.0.1:2375 testmachine2
run mchine create -d none -url tcp://127.0.0.1:2375 testmachine3
run mchine ls --filter name=testmachine2
[ "$status" -eq 0 ]
[[ ${lines[1]} =~ "testmachine2" ]]
}
@test "ls: filter on name with regex" {
run mchine create -d none -url tcp://127.0.0.1:2375 squirrel
run mchine create -d none -url tcp://127.0.0.1:2375 cat
run mchine create -d none -url tcp://127.0.0.1:2375 dog
run mchine ls --filter name=c.?t
[ "$status" -eq 0 ]
[[ ${lines[1]} =~ "cat" ]]
}