diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c026ea28..65e82305a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 .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 .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