mirror of
https://github.com/docker/docs.git
synced 2026-04-02 01:08:53 +07:00
- Use start_with_busybox everywhere it's possible. - Start only what we need. - Improved correctness of a few tests at the same time. Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
47 lines
1.1 KiB
Bash
47 lines
1.1 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load ../helpers
|
|
|
|
function teardown() {
|
|
swarm_manage_cleanup
|
|
stop_docker
|
|
}
|
|
|
|
@test "docker ps -n" {
|
|
start_docker_with_busybox 2
|
|
swarm_manage
|
|
|
|
run docker_swarm run -d busybox sleep 42
|
|
run docker_swarm run -d busybox false
|
|
run docker_swarm ps -n 3
|
|
# Non-running containers should be included in ps -n
|
|
[ "${#lines[@]}" -eq 3 ]
|
|
|
|
run docker_swarm run -d busybox true
|
|
run docker_swarm ps -n 3
|
|
[ "${#lines[@]}" -eq 4 ]
|
|
|
|
run docker_swarm run -d busybox true
|
|
run docker_swarm ps -n 3
|
|
[ "${#lines[@]}" -eq 4 ]
|
|
}
|
|
|
|
@test "docker ps -l" {
|
|
start_docker_with_busybox 2
|
|
swarm_manage
|
|
|
|
run docker_swarm run -d busybox sleep 42
|
|
sleep 1 #sleep so the 2 containers don't start at the same second
|
|
run docker_swarm run -d busybox true
|
|
run docker_swarm ps -l
|
|
[ "${#lines[@]}" -eq 2 ]
|
|
# Last container should be "true", even though it's stopped.
|
|
[[ "${lines[1]}" == *"true"* ]]
|
|
|
|
sleep 1 #sleep so the container doesn't start at the same second as 'busybox true'
|
|
run docker_swarm run -d busybox false
|
|
run docker_swarm ps -l
|
|
[ "${#lines[@]}" -eq 2 ]
|
|
[[ "${lines[1]}" == *"false"* ]]
|
|
}
|