mirror of https://github.com/docker/docs.git
commit
43d9df3216
|
@ -12,7 +12,8 @@ load ${BASE_TEST_DIR}/helpers.bash
|
||||||
|
|
||||||
@test "$DRIVER: test docker process envs" {
|
@test "$DRIVER: test docker process envs" {
|
||||||
# get pid of docker process, check process envs for set Environment Variable from above test
|
# get pid of docker process, check process envs for set Environment Variable from above test
|
||||||
run machine ssh $NAME 'pgrep -f "docker daemon" | xargs -I % sudo cat /proc/%/environ | grep -q "TEST=VALUE"'
|
run machine ssh $NAME 'sudo cat /proc/$(pgrep -f "docker [d]aemon")/environ'
|
||||||
echo ${output}
|
echo ${output}
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
|
[[ "${output}" =~ "TEST=VALUE" ]]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,12 @@ function cleanup_machines() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanup_store() {
|
||||||
|
if [[ -d "$MACHINE_STORAGE_PATH" ]]; then
|
||||||
|
rm -r "$MACHINE_STORAGE_PATH"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function machine() {
|
function machine() {
|
||||||
export PATH="$MACHINE_ROOT"/bin:$PATH
|
export PATH="$MACHINE_ROOT"/bin:$PATH
|
||||||
"$MACHINE_ROOT"/bin/"$MACHINE_BIN_NAME" "$@"
|
"$MACHINE_ROOT"/bin/"$MACHINE_BIN_NAME" "$@"
|
||||||
|
@ -30,13 +36,15 @@ 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
|
|
||||||
echo "=> $bats_file"
|
echo "=> $bats_file"
|
||||||
|
|
||||||
|
set +e
|
||||||
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
|
echo
|
||||||
cleanup_machines
|
cleanup_machines
|
||||||
done
|
done
|
||||||
|
@ -67,28 +75,23 @@ export MACHINE_ROOT="$BASE_TEST_DIR/../.."
|
||||||
export MACHINE_STORAGE_PATH="/tmp/machine-bats-test-$DRIVER"
|
export MACHINE_STORAGE_PATH="/tmp/machine-bats-test-$DRIVER"
|
||||||
export MACHINE_BIN_NAME=docker-machine
|
export MACHINE_BIN_NAME=docker-machine
|
||||||
export BATS_LOG="$MACHINE_ROOT/bats.log"
|
export BATS_LOG="$MACHINE_ROOT/bats.log"
|
||||||
B2D_LOCATION=~/.docker/machine/cache/boot2docker.iso
|
export B2D_LOCATION=~/.docker/machine/cache/boot2docker.iso
|
||||||
|
|
||||||
# This function gets used in the integration tests, so export it.
|
# This function gets used in the integration tests, so export it.
|
||||||
export -f machine
|
export -f machine
|
||||||
|
|
||||||
touch "$BATS_LOG"
|
> "$BATS_LOG"
|
||||||
rm "$BATS_LOG"
|
|
||||||
|
|
||||||
cleanup_machines
|
cleanup_machines
|
||||||
if [[ -d "$MACHINE_STORAGE_PATH" ]]; then
|
cleanup_store
|
||||||
rm -r "$MACHINE_STORAGE_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$b2dcache" == "1" ]] && [[ -f $B2D_LOCATION ]]; then
|
if [[ "$B2D_CACHE" == "1" ]] && [[ -f $B2D_LOCATION ]]; then
|
||||||
mkdir -p "${MACHINE_STORAGE_PATH}/cache"
|
mkdir -p "${MACHINE_STORAGE_PATH}/cache"
|
||||||
cp $B2D_LOCATION "${MACHINE_STORAGE_PATH}/cache/boot2docker.iso"
|
cp $B2D_LOCATION "${MACHINE_STORAGE_PATH}/cache/boot2docker.iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_bats "$BATS_FILE"
|
run_bats "$BATS_FILE"
|
||||||
|
|
||||||
if [[ -d "$MACHINE_STORAGE_PATH" ]]; then
|
cleanup_store
|
||||||
rm -r "$MACHINE_STORAGE_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit ${EXIT_STATUS}
|
exit ${EXIT_STATUS}
|
||||||
|
|
Loading…
Reference in New Issue