From 54efa94018cd13c61c93c3c9d72471e50d0cff1e Mon Sep 17 00:00:00 2001
From: Ryan Sanford <ryansanford@flywheel.io>
Date: Wed, 8 Jun 2016 07:54:22 -0500
Subject: [PATCH] test execution script fail on bootstrap error

---
 bin/runtests.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/bin/runtests.sh b/bin/runtests.sh
index 1d3e23c5..a335c148 100755
--- a/bin/runtests.sh
+++ b/bin/runtests.sh
@@ -1,4 +1,9 @@
 #!/bin/bash
+
+# Convenience script for unit and integration test execution consumed by
+# continous integration workflow (travis)
+#
+# Must return non-zero on any failure.
 set -e
 
 unit_test_path=test/unit_tests/
@@ -19,13 +24,24 @@ case "$1-$2" in
     PYTHONPATH=. ptw $unit_test_path $code_path --poll -- $unit_test_path
     ;;
   integration---ci|integration-)
+    # Bootstrap and run integration test.
+    #  - always stop and remove docker containers
+    #  - always exit non-zero if either bootstrap or integration tests fail.
+    #  - only run integration tests on bootstrap success
+
       docker-compose \
         -f test/docker-compose.yml \
         run \
         --rm \
         bootstrap  && \
-      docker-compose -f test/docker-compose.yml run --rm integration-test
+      docker-compose \
+        -f test/docker-compose.yml \
+        run \
+        --rm \
+        integration-test || \
+      exit_code=1
     docker-compose -f test/docker-compose.yml down
+    exit $exit_code
     ;;
   integration---watch)
     echo "Not implemented"
-- 
GitLab