1
0
mirror of https://github.com/docker/docs.git synced 2026-11-11 04:02:07 +03:00

add events-search-stats-version-wait integration test

Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
This commit is contained in:
Xian Chaobo
2015-04-22 06:16:12 +08:00
parent fdf74cef2a
commit f83b3daabb

View File

@@ -182,9 +182,29 @@ function teardown() {
[[ "${lines[*]}" == *"diff.txt"* ]]
}
# FIXME
@test "docker events" {
skip
TEMP_FILE=$(mktemp)
start_docker 3
swarm_manage
# start events, report real time events to TEMP_FILE
docker_swarm events > $TEMP_FILE &
# events: create container
run docker_swarm create --name test_container busybox sleep 100
[ "$status" -eq 0 ]
# events: start container
run docker_swarm start test_container
[ "$status" -eq 0 ]
# make sure $TEMP_FILE exists and is not empty
[ -s $TEMP_FILE ]
# verify
run cat $TEMP_FILE
[ "$status" -eq 0 ]
[[ "${output}" == *"create"* ]]
[[ "${output}" == *"start"* ]]
}
@test "docker exec" {
@@ -748,9 +768,27 @@ function teardown() {
rm -f $temp_file_name_o
}
# FIXME
@test "docker search" {
skip
start_docker 3
swarm_manage
TEMP_NAME=noimage$RANDOM
# search image (not exist), the name of images only [a-z0-9-_.] are allowed
run docker_swarm search $TEMP_NAME
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 1 ]
[[ "${lines[0]}" == *"DESCRIPTION"* ]]
# search busybox (image exist)
run docker_swarm search busybox
[ "$status" -eq 0 ]
# search existed image, output: latest + header at least
[ "${#lines[@]}" -ge 2 ]
# Every line should contain "busybox" exclude the first head line
for((i=1; i<${#lines[@]}; i++)); do
[[ "${lines[i]}" == *"busybox"* ]]
done
}
@test "docker start" {
@@ -775,9 +813,32 @@ function teardown() {
[[ "${lines[1]}" == *"Up"* ]]
}
# FIXME
@test "docker stats" {
skip
TEMP_FILE=$(mktemp)
start_docker 3
swarm_manage
# stats running container
run docker_swarm run -d --name test_container busybox sleep 50
[ "$status" -eq 0 ]
# make sure container is up
run docker_swarm ps -l
[ "${#lines[@]}" -eq 2 ]
[[ "${lines[1]}" == *"test_container"* ]]
[[ "${lines[1]}" == *"Up"* ]]
# storage the real time output of stats in TEMP_FILE
docker_swarm stats test_container > $TEMP_FILE &
# make sure TEMP_FILE exists and is not empty
sleep 3
[ -s $TEMP_FILE ]
# if "CPU %" in TEMP_FILE, status is 0
run grep "CPU %" $TEMP_FILE
[ "$status" -eq 0 ]
run grep "MEM USAGE/LIMIT" $TEMP_FILE
[ "$status" -eq 0 ]
}
@test "docker stop" {
@@ -880,12 +941,39 @@ function teardown() {
[[ "${lines[1]}" != *"Paused"* ]]
}
# FIXME
@test "docker version" {
skip
start_docker 3
swarm_manage
# version
run docker_swarm version
[ "$status" -eq 0 ]
[ "${#lines[@]}" -ge 8 ]
# verify
client_reg='^Client version: [0-9]+\.[0-9]+\.[0-9]+$'
server_reg='^Server version: swarm/[0-9]+\.[0-9]+\.[0-9]+$'
[[ "${lines[0]}" =~ $client_reg ]]
[[ "${lines[5]}" =~ $server_reg ]]
}
# FIXME
@test "docker wait" {
skip
start_docker 3
swarm_manage
# run after 10 seconds, test_container will exit
run docker_swarm run -d --name test_container busybox sleep 10
[ "$status" -eq 0 ]
# make sure container exists and is up
run docker_swarm ps -l
[ "${#lines[@]}" -eq 2 ]
[[ "${lines[1]}" == *"test_container"* ]]
[[ "${lines[1]}" == *"Up"* ]]
# wait until exist(after 10 seconds)
run docker_swarm wait test_container
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 1 ]
[[ "${lines[0]}" == "0" ]]
}