mirror of https://github.com/docker/docs.git
FIX #2490 - Reuse machines in ITs
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
57085d89e5
commit
3071da0673
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(unique_machine_name)"
|
||||
fi
|
||||
use_disposable_machine
|
||||
|
||||
@test "$DRIVER: create" {
|
||||
run machine create --tls-san foo.bar.tld --tls-san 10.42.42.42 -d $DRIVER $NAME
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: machine should not exist" {
|
||||
run machine inspect UNKNOWN
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(unique_machine_name)"
|
||||
fi
|
||||
use_disposable_machine
|
||||
|
||||
@test "$DRIVER: create with supported engine options" {
|
||||
run machine create -d $DRIVER \
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: test basic bash / zsh notation" {
|
||||
run machine env $NAME
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: inspect format template" {
|
||||
run machine inspect -f '{{.DriverName}}' $NAME
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: regenerate the certs" {
|
||||
run machine regenerate-certs -f $NAME
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
export SECOND_MACHINE="$NAME-2"
|
||||
fi
|
||||
use_shared_machine
|
||||
export SECOND_MACHINE="$NAME-2"
|
||||
|
||||
@test "$DRIVER: test machine scp command from remote to host" {
|
||||
machine ssh $NAME 'echo A file created remotely! >/tmp/foo.txt'
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
load ${BASE_TEST_DIR}/helpers.bash
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: test external ssh backend" {
|
||||
run machine ssh $NAME df -h
|
||||
|
|
|
|||
|
|
@ -31,15 +31,19 @@ function require_env {
|
|||
fi
|
||||
}
|
||||
|
||||
function unique_machine_name {
|
||||
echo "bats-$DRIVER-test-$(date +%s)"
|
||||
function use_disposable_machine {
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="bats-$DRIVER-test-$(date +%s)"
|
||||
fi
|
||||
}
|
||||
|
||||
function shared_machine_name {
|
||||
if [[ $(machine ls -q --filter name=$SHARED_NAME | wc -l) -eq 0 ]]; then
|
||||
machine create -d $DRIVER $SHARED_NAME &>/dev/null
|
||||
function use_shared_machine {
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$SHARED_NAME"
|
||||
if [[ $(machine ls -q --filter name=$NAME | wc -l) -eq 0 ]]; then
|
||||
machine create -d $DRIVER $NAME &>/dev/null
|
||||
fi
|
||||
fi
|
||||
echo "$SHARED_NAME"
|
||||
}
|
||||
|
||||
# Make sure these aren't set while tests run (can cause confusing behavior)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,12 @@ function run_bats() {
|
|||
set -e
|
||||
|
||||
echo
|
||||
cleanup_machines
|
||||
|
||||
if [[ "$NO_SHARE_MACHINES" == "1" ]]; then
|
||||
cleanup_machines "ALL"
|
||||
else
|
||||
cleanup_machines "NON-SHARED"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ load ${BASE_TEST_DIR}/helpers.bash
|
|||
|
||||
only_if_env DRIVER virtualbox
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(unique_machine_name)"
|
||||
fi
|
||||
use_disposable_machine
|
||||
|
||||
export BAD_URL="http://dev.null:9111/bad.iso"
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ load ${BASE_TEST_DIR}/helpers.bash
|
|||
|
||||
only_if_env DRIVER virtualbox
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: verify that server cert checksum matches local checksum" {
|
||||
# TODO: This test is tightly coupled to VirtualBox right now, but should be
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ load ${BASE_TEST_DIR}/helpers.bash
|
|||
|
||||
only_if_env DRIVER virtualbox
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(unique_machine_name)"
|
||||
fi
|
||||
use_disposable_machine
|
||||
|
||||
# Default memsize is 1024MB and disksize is 20000MB
|
||||
# These values are defined in drivers/virtualbox/virtualbox.go
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ load ${BASE_TEST_DIR}/helpers.bash
|
|||
|
||||
only_if_env DRIVER virtualbox
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(unique_machine_name)"
|
||||
fi
|
||||
use_disposable_machine
|
||||
|
||||
@test "$DRIVER: Create a vm with a dns proxy set" {
|
||||
run machine create -d $DRIVER --virtualbox-dns-proxy=true $NAME
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ load ${BASE_TEST_DIR}/helpers.bash
|
|||
|
||||
only_if_env DRIVER virtualbox
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(shared_machine_name)"
|
||||
fi
|
||||
use_shared_machine
|
||||
|
||||
@test "$DRIVER: VBoxManage pause" {
|
||||
run VBoxManage controlvm $NAME pause
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ load ${BASE_TEST_DIR}/helpers.bash
|
|||
|
||||
only_if_env DRIVER virtualbox
|
||||
|
||||
if [[ -z "$NAME" ]]; then
|
||||
export NAME="$(unique_machine_name)"
|
||||
fi
|
||||
use_disposable_machine
|
||||
|
||||
export OLD_ISO_URL="https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue