travis: run with ginkgo -p instead of go test
authorGabe Rosenhouse <grosenhouse@pivotal.io>
Thu, 31 Aug 2017 03:22:12 +0000 (20:22 -0700)
committerGabe Rosenhouse <grosenhouse@pivotal.io>
Thu, 31 Aug 2017 03:22:12 +0000 (20:22 -0700)
may help reduce test-pollution due to namespace-affinity

see http://onsi.github.io/ginkgo/#parallel-specs

.travis.yml
test.sh

index be69056..68a7e4d 100644 (file)
@@ -8,7 +8,7 @@ go:
 
 env:
   global:
-  - PATH=$GOROOT/bin:$PATH
+  - PATH=$GOROOT/bin:$GOPATH/bin:$PATH
   matrix:
   - TARGET=amd64
   - TARGET=arm
@@ -19,6 +19,9 @@ env:
 matrix:
   fast_finish: true
 
+install:
+  - go get github.com/onsi/ginkgo/ginkgo
+
 script:
  - |
    if [ "${TARGET}" == "amd64" ]; then
diff --git a/test.sh b/test.sh
index 430a832..a5500e7 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -12,33 +12,34 @@ echo "Running tests"
 
 # test everything that's not in vendor
 pushd "$GOPATH/src/$REPO_PATH" >/dev/null
-  TESTABLE="$(go list ./... | grep -v vendor | xargs echo)"
+  ALL_PKGS="$(go list ./... | grep -v vendor | xargs echo)"
 popd >/dev/null
 
+GINKGO_FLAGS="-p --randomizeAllSpecs --randomizeSuites --failOnPending --progress"
+
 # user has not provided PKG override
 if [ -z "$PKG" ]; then
-       TEST=$TESTABLE
-       FMT=$TESTABLE
+  GINKGO_FLAGS="$GINKGO_FLAGS -r ."
+  LINT_TARGETS="$ALL_PKGS"
 
 # user has provided PKG override
 else
-       TEST=$PKG
-
-       # only run gofmt on packages provided by user
-       FMT="$TEST"
+  GINKGO_FLAGS="$GINKGO_FLAGS $PKG"
+  LINT_TARGETS="$PKG"
 fi
 
-sudo -E bash -c "umask 0; PATH=${GOROOT}/bin:$(pwd)/bin:${PATH} go test ${TEST}"
+cd "$GOPATH/src/$REPO_PATH"
+sudo -E bash -c "umask 0; PATH=${GOROOT}/bin:$(pwd)/bin:${PATH} ginkgo ${GINKGO_FLAGS}"
 
 echo "Checking gofmt..."
-fmtRes=$(go fmt $FMT)
+fmtRes=$(go fmt $LINT_TARGETS)
 if [ -n "${fmtRes}" ]; then
        echo -e "go fmt checking failed:\n${fmtRes}"
        exit 255
 fi
 
 echo "Checking govet..."
-vetRes=$(go vet $TEST)
+vetRes=$(go vet $LINT_TARGETS)
 if [ -n "${vetRes}" ]; then
        echo -e "govet checking failed:\n${vetRes}"
        exit 255