mirror of https://github.com/docker/docs.git
Merge pull request #1304 from nathanleclaire/integration_continues
Add some helpers and patch ups to the integration tests
This commit is contained in:
commit
30c2086cdf
|
@ -15,8 +15,3 @@ load ${BASE_TEST_DIR}/helpers.bash
|
||||||
run docker $(machine config $NAME) version
|
run docker $(machine config $NAME) version
|
||||||
[[ ${status} -eq 0 ]]
|
[[ ${status} -eq 0 ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "cleanup" {
|
|
||||||
machine rm $NAME
|
|
||||||
[[ ${status} -eq 0 ]]
|
|
||||||
}
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ export SECOND_MACHINE="$NAME-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "$DRIVER: test machine scp command from host to remote" {
|
@test "$DRIVER: test machine scp command from host to remote" {
|
||||||
|
teardown () {
|
||||||
|
rm foo.txt
|
||||||
|
}
|
||||||
echo A file created locally! >foo.txt
|
echo A file created locally! >foo.txt
|
||||||
machine scp foo.txt $NAME:/tmp/foo.txt
|
machine scp foo.txt $NAME:/tmp/foo.txt
|
||||||
[[ $(machine ssh $NAME cat /tmp/foo.txt) == "A file created locally!" ]]
|
[[ $(machine ssh $NAME cat /tmp/foo.txt) == "A file created locally!" ]]
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
load ${BASE_TEST_DIR}/helpers.bash
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER virtualbox
|
||||||
|
|
||||||
export BAD_URL="http://dev.null:9111/bad.iso"
|
export BAD_URL="http://dev.null:9111/bad.iso"
|
||||||
|
|
||||||
@test "$DRIVER: Should not allow machine creation with bad ISO" {
|
@test "$DRIVER: Should not allow machine creation with bad ISO" {
|
||||||
|
|
|
@ -2,22 +2,25 @@
|
||||||
|
|
||||||
load ${BASE_TEST_DIR}/helpers.bash
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER virtualbox
|
||||||
|
|
||||||
@test "$DRIVER: create" {
|
@test "$DRIVER: create" {
|
||||||
run machine create -d $DRIVER $NAME
|
run machine create -d $DRIVER $NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "$DRIVER: verify that server cert checksum matches local checksum" {
|
@test "$DRIVER: verify that server cert checksum matches local checksum" {
|
||||||
|
# TODO: This test is tightly coupled to VirtualBox right now, but should be
|
||||||
|
# available for all providers ideally.
|
||||||
|
#
|
||||||
# TODO: Does this test work OK on Linux? cc @ehazlett
|
# TODO: Does this test work OK on Linux? cc @ehazlett
|
||||||
|
#
|
||||||
# Have to create this directory and file or else the OpenSSL checksum will barf.
|
# Have to create this directory and file or else the OpenSSL checksum will barf.
|
||||||
machine ssh $NAME -- sudo mkdir -p /usr/local/ssl
|
machine ssh $NAME -- sudo mkdir -p /usr/local/ssl
|
||||||
machine ssh $NAME -- sudo touch /usr/local/ssl/openssl.cnf
|
machine ssh $NAME -- sudo touch /usr/local/ssl/openssl.cnf
|
||||||
|
|
||||||
SERVER_CHECKSUM=$(machine ssh $NAME -- openssl dgst -sha256 /var/lib/boot2docker/ca.pem | awk '{ print $2 }')
|
SERVER_CHECKSUM=$(machine ssh $NAME -- openssl dgst -sha256 /var/lib/boot2docker/ca.pem | awk '{ print $2 }')
|
||||||
LOCAL_CHECKSUM=$(openssl dgst -sha256 $MACHINE_STORAGE_PATH/certs/ca.pem | awk '{ print $2 }')
|
LOCAL_CHECKSUM=$(openssl dgst -sha256 $MACHINE_STORAGE_PATH/certs/ca.pem | awk '{ print $2 }')
|
||||||
echo ${SERVER_CHECKSUM}
|
echo ${SERVER_CHECKSUM}
|
||||||
echo ${LOCAL_CHECKSUM}
|
echo ${LOCAL_CHECKSUM}
|
||||||
[[ ${SERVER_CHECKSUM} == ${LOCAL_CHECKSUM} ]]
|
[[ ${SERVER_CHECKSUM} == ${LOCAL_CHECKSUM} ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "cleanup" {
|
|
||||||
machine rm $NAME
|
|
||||||
}
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
load ${BASE_TEST_DIR}/helpers.bash
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER virtualbox
|
||||||
|
|
||||||
# Default memsize is 1024MB and disksize is 20000MB
|
# Default memsize is 1024MB and disksize is 20000MB
|
||||||
# These values are defined in drivers/virtualbox/virtualbox.go
|
# These values are defined in drivers/virtualbox/virtualbox.go
|
||||||
export DEFAULT_MEMSIZE=1024
|
export DEFAULT_MEMSIZE=1024
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
load ${BASE_TEST_DIR}/helpers.bash
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER virtualbox
|
||||||
|
|
||||||
@test "$DRIVER: create" {
|
@test "$DRIVER: create" {
|
||||||
run machine create -d $DRIVER $NAME
|
run machine create -d $DRIVER $NAME
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
load ${BASE_TEST_DIR}/helpers.bash
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER virtualbox
|
||||||
|
|
||||||
export OLD_ISO_URL="https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso"
|
export OLD_ISO_URL="https://github.com/boot2docker/boot2docker/releases/download/v1.4.1/boot2docker.iso"
|
||||||
|
|
||||||
@test "$DRIVER: create for upgrade" {
|
@test "$DRIVER: create for upgrade" {
|
||||||
|
|
|
@ -1,10 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
echo "$BATS_TEST_NAME
|
echo "$BATS_TEST_NAME
|
||||||
----------
|
----------
|
||||||
$output
|
$output
|
||||||
----------
|
----------
|
||||||
|
|
||||||
" >> ${BATS_LOG}
|
" >> ${BATS_LOG}
|
||||||
|
}
|
||||||
|
|
||||||
|
function errecho () {
|
||||||
|
>&2 echo "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function force_env () {
|
||||||
|
if [[ ${!1} != "$2" ]]; then
|
||||||
|
errecho "This test requires the $1 environment variable to be set to $2 in order to run properly."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function require_env () {
|
||||||
|
if [[ -z ${!1} ]]; then
|
||||||
|
errecho "This test requires the $1 environment variable to be set in order to run."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER virtualbox
|
||||||
|
|
||||||
|
export RANCHEROS_VERSION="v0.3.1"
|
||||||
|
export RANCHEROS_ISO="https://github.com/rancherio/os/releases/download/$RANCHEROS_VERSION/machine-rancheros.iso"
|
||||||
|
|
||||||
|
@test "$DRIVER: create with RancherOS ISO" {
|
||||||
|
VIRTUALBOX_BOOT2DOCKER_URL="$RANCHEROS_ISO" run ${BASE_TEST_DIR}/run-bats.sh ${BASE_TEST_DIR}/core
|
||||||
|
echo ${output}
|
||||||
|
[ ${status} -eq 0 ]
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
|
force_env DRIVER amazonec2
|
||||||
|
|
||||||
|
require_env AWS_VPC_ID
|
||||||
|
require_env AWS_ACCESS_KEY_ID
|
||||||
|
require_env AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
@test "$DRIVER: create using RedHat AMI" {
|
||||||
|
# Oh snap, recursive stuff!!
|
||||||
|
AWS_AMI=ami-12663b7a AWS_SSH_USER=ec2-user run ${BASE_TEST_DIR}/run-bats.sh ${BASE_TEST_DIR}/core
|
||||||
|
echo ${output}
|
||||||
|
[ ${status} -eq 0 ]
|
||||||
|
}
|
|
@ -35,11 +35,13 @@ function run_bats() {
|
||||||
# BATS returns non-zero to indicate the tests have failed, we shouldn't
|
# BATS returns non-zero to indicate the tests have failed, we shouldn't
|
||||||
# neccesarily bail in this case, so that's the reason for the e toggle.
|
# neccesarily bail in this case, so that's the reason for the e toggle.
|
||||||
set +e
|
set +e
|
||||||
|
echo "=> $bats_file"
|
||||||
bats "$bats_file"
|
bats "$bats_file"
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
EXIT_STATUS=1
|
EXIT_STATUS=1
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
echo
|
||||||
cleanup_machines
|
cleanup_machines
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,7 @@ if [ ! -e "$MACHINE_ROOT"/"$MACHINE_BIN_NAME" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$DRIVER" ]]; then
|
if [[ -z "$DRIVER" ]]; then
|
||||||
echo "The DRIVER environment variable must be set."
|
echo "You must specify the DRIVER environment variable."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue