Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
This commit is contained in:
Xian Chaobo 2015-04-21 22:33:57 +08:00 committed by root
parent 9ab51c796d
commit 33dc4455eb
1 changed files with 14 additions and 45 deletions

View File

@ -141,10 +141,15 @@ function teardown() {
swarm_manage
# no image exist
run docker_swarm images
run docker_swarm images -q
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 1 ]
[[ "${lines[0]}" == *"REPOSITORY"* ]]
[ "${#lines[@]}" -eq 0 ]
# make sure every node has no image
for((i=0; i<3; i++)); do
run docker_swarm images --filter node=node-$i -q
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 0 ]
done
# pull image
run docker_swarm pull busybox
@ -161,38 +166,9 @@ function teardown() {
for((i=1; i<${#lines[@]}; i++)); do
[[ "${lines[i]}" == *"busybox"* ]]
done
}
@test "docker images --filter node=<Node name>" {
start_docker 3
swarm_manage
# no image exist
run docker_swarm images
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 1 ]
[[ "${lines[0]}" == *"REPOSITORY"* ]]
# make sure every node has no image
for((i=0;i<3;i++)); do
run docker_swarm images --filter node=node-$i
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 1 ]
[[ "${lines[0]}" == *"REPOSITORY"* ]]
done
# pull image
run docker_swarm pull busybox
[ "$status" -eq 0 ]
# make sure images have pulled
run docker_swarm images
[ "$status" -eq 0 ]
[ "${#lines[@]}" -ge 4 ]
[[ "${lines[1]}" == *"busybox"* ]]
# verify
for((i=0; i<3; i++)); do
for((i=0; i<3; i++)); do
run docker_swarm images --filter node=node-$i
[ "$status" -eq 0 ]
[ "${#lines[@]}" -ge 2 ]
@ -347,12 +323,6 @@ function teardown() {
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 0 ]
for host in ${HOSTS[@]}; do
run docker -H $host images -q
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 0 ]
done
run docker_swarm pull busybox
[ "$status" -eq 0 ]
@ -581,18 +551,17 @@ function teardown() {
run docker_swarm images
[ "$status" -eq 0 ]
[ "${#lines[@]}" -ge 2 ]
[[ "${lines[*]}" == *"busybox"* ]]
[[ "${lines[*]}" != *"tag_busybox"* ]]
[[ "${output}" == *"busybox"* ]]
[[ "${output}" != *"tag_busybox"* ]]
# tag image
run docker_swarm tag busybox tag_busybox:test
[ "$status" -eq 0 ]
# verify
run docker_swarm images
run docker_swarm images tag_busybox
[ "$status" -eq 0 ]
[ "${#lines[@]}" -ge 2 ]
[[ "${lines[*]}" == *"tag_busybox"* ]]
[[ "${output}" == *"tag_busybox"* ]]
}
@test "docker top" {