@@ -14,9 +14,11 @@ function quiet_run () {
1414}
1515
1616function cleanup_machines() {
17- if [[ $( machine ls -q | wc -l) -ne 0 ]]; then
18- quiet_run machine rm -f $( machine ls -q)
19- fi
17+ for MACHINE_NAME in $( machine ls -q) ; do
18+ if [[ " $MACHINE_NAME " != " $SHARED_NAME " ]] || [[ " $1 " == " ALL" ]]; then
19+ quiet_run machine rm -f $MACHINE_NAME
20+ fi
21+ done
2022}
2123
2224function cleanup_store() {
@@ -26,18 +28,15 @@ function cleanup_store() {
2628}
2729
2830function machine() {
29- export PATH=" $MACHINE_ROOT " /bin:$PATH
3031 " $MACHINE_ROOT " /bin/" $MACHINE_BIN_NAME " " $@ "
3132}
3233
3334function run_bats() {
3435 for bats_file in $( find " $1 " -name \* .bats) ; do
35- export NAME=" bats-$DRIVER -test-$( date +%s) "
36-
37- # BATS returns non-zero to indicate the tests have failed, we shouldn't
38- # neccesarily bail in this case, so that's the reason for the e toggle.
3936 echo " => $bats_file "
4037
38+ # BATS returns non-zero to indicate the tests have failed, we shouldn't
39+ # necessarily bail in this case, so that's the reason for the e toggle.
4140 set +e
4241 bats " $bats_file "
4342 if [[ $? -ne 0 ]]; then
@@ -88,13 +87,14 @@ export MACHINE_STORAGE_PATH="/tmp/machine-bats-test-$DRIVER"
8887export MACHINE_BIN_NAME=docker-machine
8988export BATS_LOG=" $MACHINE_ROOT /bats.log"
9089export B2D_LOCATION=~ /.docker/machine/cache/boot2docker.iso
90+ export SHARED_NAME=" bats-$DRIVER -test-shared-$( date +%s) "
9191
9292# This function gets used in the integration tests, so export it.
9393export -f machine
9494
9595> " $BATS_LOG "
9696
97- cleanup_machines
97+ cleanup_machines " ALL "
9898cleanup_store
9999
100100if [[ -f " $B2D_LOCATION " ]]; then
108108
109109run_bats " $BATS_FILE "
110110
111+ cleanup_machines " ALL"
111112cleanup_store
112113
113114exit ${EXIT_STATUS}
0 commit comments