Run go test packages in parallel (#6165)

* modify gotestsum hacking that is unnecessary with the latest version

* try running 2 packages at a time

* try running 3 packages at a time

* remove old comments
This commit is contained in:
Alvin Huang 2019-07-22 14:01:22 -04:00 committed by GitHub
parent 2602f6907e
commit f3469dbe4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 18 deletions

View File

@ -77,16 +77,9 @@ jobs:
- run: mkdir -p $TEST_RESULTS_DIR
- run: sudo apt-get update && sudo apt-get install -y rsyslog
- run: sudo service rsyslog start
# Use CircleCI test splitting by classname. Since there are no classes in go,
# we fake it by taking everything after github.com/hashicorp/consul/ and setting
# it as the classname.
# This loop writes go test results to <reportname>.xml per go package
- run: |
for pkg in $(go list ./... | grep -v github.com/hashicorp/consul/agent/proxyprocess |circleci tests split --split-by=timings --timings-type=classname | tr '\n' ' '); do
reportname=$(echo $pkg | cut -d '/' -f3- | sed "s#/#_#g")
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/$reportname.xml -- -tags=$GOTAGS $pkg
done
PACKAGE_NAMES=$(go list ./... | grep -v github.com/hashicorp/consul/agent/proxyprocess | circleci tests split --split-by=timings --timings-type=classname)
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -tags=$GOTAGS -p 3 $PACKAGE_NAMES
- store_test_results:
path: /tmp/test-results
@ -108,18 +101,11 @@ jobs:
- attach_workspace:
at: /go/bin
- run: mkdir -p $TEST_RESULTS_DIR
# Use CircleCI test splitting by classname. Since there are no classes in go,
# we fake it by taking everything after github.com/hashicorp/consul/ and setting
# it as the classname.
# This loop writes go test results to <reportname>.xml per go package
- run:
working_directory: api
command: |
for pkg in $(go list ./... | circleci tests split --split-by=timings --timings-type=classname | tr '\n' ' '); do
reportname=$(echo $pkg | cut -d '/' -f3- | sed "s#/#_#g")
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/$reportname.xml -- -tags=$GOTAGS $pkg
done
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -tags=$GOTAGS $PACKAGE_NAMES
- store_test_results:
path: /tmp/test-results