mirror of https://github.com/docker/docs.git
Merge pull request #750 from jimmyxian/fix-run
Fix all api tests which do not need to use "run"
This commit is contained in:
commit
833377929b
|
@ -12,8 +12,7 @@ function teardown() {
|
|||
swarm_manage
|
||||
|
||||
# container run in background
|
||||
run docker_swarm run -d -i --name test_container busybox sh -c "head -n 1; echo output"
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d -i --name test_container busybox sh -c "head -n 1; echo output"
|
||||
|
||||
# inject input into the container
|
||||
attach_output=`echo input | docker_swarm attach test_container`
|
||||
|
@ -31,8 +30,7 @@ function teardown() {
|
|||
swarm_manage
|
||||
|
||||
#create a container
|
||||
run docker_swarm run -d --name test_container busybox sleep 1000
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 1000
|
||||
|
||||
# test attach-ws api
|
||||
# jimmyxian/centos7-wssh is an image with websocket CLI(WSSH) wirtten in Nodejs
|
||||
|
|
|
@ -15,8 +15,7 @@ function teardown() {
|
|||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 0 ]
|
||||
|
||||
run docker_swarm build -t test $TESTDATA/build
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm build -t test $TESTDATA/build
|
||||
|
||||
run docker_swarm images -q
|
||||
[ "$status" -eq 0 ]
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container exists
|
||||
run docker_swarm ps -l
|
||||
|
@ -25,8 +24,7 @@ function teardown() {
|
|||
[[ "${output}" != *"commit_image_busybox"* ]]
|
||||
|
||||
# commit container
|
||||
run docker_swarm commit test_container commit_image_busybox
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm commit test_container commit_image_busybox
|
||||
|
||||
# verify after commit
|
||||
run docker_swarm images
|
||||
|
|
|
@ -16,8 +16,7 @@ function teardown() {
|
|||
temp_dest=`mktemp -d`
|
||||
|
||||
# create the container
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container is up and no comming file
|
||||
run docker_swarm ps -l
|
||||
|
@ -38,8 +37,7 @@ function teardown() {
|
|||
[ ! -f $host_file ]
|
||||
|
||||
# copy the test file from the container to the host.
|
||||
run docker_swarm cp test_container:$test_file $temp_dest
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm cp test_container:$test_file $temp_dest
|
||||
[ -f $host_file ]
|
||||
|
||||
# compute the checksum of the copied file.
|
||||
|
|
|
@ -10,8 +10,7 @@ function teardown() {
|
|||
@test "docker diff" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container is up
|
||||
run docker_swarm ps -l
|
||||
|
@ -25,8 +24,8 @@ function teardown() {
|
|||
[ "${#lines[@]}" -eq 0 ]
|
||||
|
||||
# make changes on container's filesystem
|
||||
run docker_swarm exec test_container touch /home/diff.txt
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm exec test_container touch /home/diff.txt
|
||||
|
||||
# verify
|
||||
run docker_swarm diff test_container
|
||||
[ "$status" -eq 0 ]
|
||||
|
|
|
@ -17,11 +17,10 @@ function teardown() {
|
|||
docker_swarm events > $TEMP_FILE &
|
||||
|
||||
# events: create container on node-0
|
||||
run docker_swarm create --name test_container -e constraint:node==node-0 busybox sleep 100
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm create --name test_container -e constraint:node==node-0 busybox sleep 100
|
||||
|
||||
# events: start container
|
||||
run docker_swarm start test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm start test_container
|
||||
|
||||
# verify
|
||||
run cat $TEMP_FILE
|
||||
|
|
|
@ -10,16 +10,14 @@ function teardown() {
|
|||
@test "docker exec" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
run docker_swarm create --name test_container busybox sleep 100
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm create --name test_container busybox sleep 100
|
||||
|
||||
# if container is not runing, exec will failed
|
||||
run docker_swarm exec test_container ls
|
||||
[ "$status" -ne 0 ]
|
||||
[[ "$output" == *"is not running"* ]]
|
||||
|
||||
run docker_swarm start test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm start test_container
|
||||
|
||||
# make sure container is up and not paused
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run a container to export
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
temp_file_name=$(mktemp)
|
||||
# make sure container exists
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run container
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container exsists
|
||||
run docker_swarm ps -l
|
||||
|
@ -35,8 +34,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run container
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container exsists
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run
|
||||
run docker_swarm run -d --name test_container busybox sleep 1000
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 1000
|
||||
|
||||
# make sure container is up before killing
|
||||
run docker_swarm ps -l
|
||||
|
@ -21,8 +20,8 @@ function teardown() {
|
|||
[[ "${lines[1]}" == *"Up"* ]]
|
||||
|
||||
# kill
|
||||
run docker_swarm kill test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm kill test_container
|
||||
|
||||
# verify
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
|
|
|
@ -21,8 +21,7 @@ function teardown() {
|
|||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 0 ]
|
||||
|
||||
run docker_swarm load -i $IMAGE_FILE
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm load -i $IMAGE_FILE
|
||||
|
||||
# and now swarm should have cought the image just loaded.
|
||||
run docker_swarm images -q
|
||||
|
|
|
@ -12,8 +12,7 @@ function teardown() {
|
|||
swarm_manage
|
||||
|
||||
# run a container with echo command
|
||||
run docker_swarm run -d --name test_container busybox /bin/sh -c "echo hello world; echo hello docker; echo hello swarm"
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox /bin/sh -c "echo hello world; echo hello docker; echo hello swarm"
|
||||
|
||||
# make sure container exists
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d --name test_container busybox sleep 1000
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 1000
|
||||
|
||||
# make sure container is up
|
||||
run docker_swarm ps -l
|
||||
|
@ -20,8 +19,7 @@ function teardown() {
|
|||
[[ "${lines[1]}" == *"test_container"* ]]
|
||||
[[ "${lines[1]}" == *"Up"* ]]
|
||||
|
||||
run docker_swarm pause test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm pause test_container
|
||||
|
||||
# verify
|
||||
run docker_swarm ps -l
|
||||
|
@ -30,6 +28,5 @@ function teardown() {
|
|||
[[ "${lines[1]}" == *"Paused"* ]]
|
||||
|
||||
# if the state of the container is paused, it can't be removed(rm -f)
|
||||
run docker_swarm unpause test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm unpause test_container
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@ function teardown() {
|
|||
@test "docker port" {
|
||||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
run docker_swarm run -d -p 8000 --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d -p 8000 --name test_container busybox sleep 500
|
||||
|
||||
# make sure container is up
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -11,17 +11,17 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d busybox sleep 42
|
||||
run docker_swarm run -d busybox false
|
||||
docker_swarm run -d busybox sleep 42
|
||||
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
|
||||
docker_swarm run -d busybox true
|
||||
run docker_swarm ps -n 3
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
|
||||
run docker_swarm run -d busybox true
|
||||
docker_swarm run -d busybox true
|
||||
run docker_swarm ps -n 3
|
||||
[ "${#lines[@]}" -eq 4 ]
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d busybox sleep 42
|
||||
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
|
||||
docker_swarm run -d busybox true
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
# Last container should be "true", even though it's stopped.
|
||||
|
|
|
@ -16,8 +16,7 @@ function teardown() {
|
|||
[ "$status" -eq 0 ]
|
||||
[ "${#lines[@]}" -eq 0 ]
|
||||
|
||||
run docker_swarm pull busybox
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm pull busybox
|
||||
|
||||
# we should get 2 busyboxes, plus the header.
|
||||
run docker_swarm images
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run
|
||||
run docker_swarm run -d --name test_container busybox sleep 1000
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 1000
|
||||
|
||||
# make sure container is up
|
||||
run docker_swarm ps -l
|
||||
|
@ -21,8 +20,8 @@ function teardown() {
|
|||
[[ "${lines[1]}" == *"Up"* ]]
|
||||
|
||||
# restart
|
||||
run docker_swarm restart test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm restart test_container
|
||||
|
||||
# verify
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
|
|
|
@ -33,8 +33,7 @@ function teardown() {
|
|||
|
||||
|
||||
# wipe busybox.
|
||||
run docker_swarm rmi busybox
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm rmi busybox
|
||||
|
||||
# swarm verify
|
||||
run docker_swarm images -q
|
||||
|
|
|
@ -16,8 +16,7 @@ function teardown() {
|
|||
[ "${#lines[@]}" -eq 0 ]
|
||||
|
||||
# run
|
||||
run docker_swarm run -d --name test_container busybox sleep 100
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 100
|
||||
|
||||
# verify, container exists
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# create
|
||||
run docker_swarm create --name test_container busybox sleep 1000
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm create --name test_container busybox sleep 1000
|
||||
|
||||
# make sure created container exists
|
||||
# new created container has no status
|
||||
|
|
|
@ -13,8 +13,7 @@ function teardown() {
|
|||
swarm_manage
|
||||
|
||||
# stats running container
|
||||
run docker_swarm run -d --name test_container busybox sleep 50
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 50
|
||||
|
||||
# make sure container is up
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
# run
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container is up before stop
|
||||
run docker_swarm ps -l
|
||||
|
@ -21,8 +20,7 @@ function teardown() {
|
|||
[[ "${lines[1]}" == *"Up"* ]]
|
||||
|
||||
# stop
|
||||
run docker_swarm stop test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm stop test_container
|
||||
|
||||
# verify
|
||||
run docker_swarm ps -l
|
||||
|
|
|
@ -23,8 +23,7 @@ function teardown() {
|
|||
[[ "${output}" != *"tag_busybox"* ]]
|
||||
|
||||
# tag image
|
||||
run docker_swarm tag busybox tag_busybox:test
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm tag busybox tag_busybox:test
|
||||
|
||||
# verify
|
||||
run docker_swarm images tag_busybox
|
||||
|
|
|
@ -11,8 +11,8 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d --name test_container busybox sleep 500
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 500
|
||||
|
||||
# make sure container is running
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
|
|
|
@ -11,8 +11,7 @@ function teardown() {
|
|||
start_docker_with_busybox 2
|
||||
swarm_manage
|
||||
|
||||
run docker_swarm run -d --name test_container busybox sleep 1000
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 1000
|
||||
|
||||
# make sure container is up
|
||||
run docker_swarm ps -l
|
||||
|
@ -21,16 +20,16 @@ function teardown() {
|
|||
[[ "${lines[1]}" == *"Up"* ]]
|
||||
|
||||
# pause
|
||||
run docker_swarm pause test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm pause test_container
|
||||
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
[[ "${lines[1]}" == *"test_container"* ]]
|
||||
[[ "${lines[1]}" == *"Paused"* ]]
|
||||
|
||||
# unpause
|
||||
run docker_swarm unpause test_container
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm unpause test_container
|
||||
|
||||
# verify
|
||||
run docker_swarm ps -l
|
||||
[ "${#lines[@]}" -eq 2 ]
|
||||
|
|
|
@ -12,8 +12,7 @@ function teardown() {
|
|||
swarm_manage
|
||||
|
||||
# run after 1 seconds, test_container will exit
|
||||
run docker_swarm run -d --name test_container busybox sleep 1
|
||||
[ "$status" -eq 0 ]
|
||||
docker_swarm run -d --name test_container busybox sleep 1
|
||||
|
||||
# make sure container exists and is up
|
||||
run docker_swarm ps -l
|
||||
|
|
Loading…
Reference in New Issue