From 4eb7689098aae5a450f2e0d12b4e3ee974be7c62 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 23 Apr 2026 10:37:46 +0200 Subject: [PATCH] ci: archive gotestsum JSON for unit and acc tests Previously `make test` wrote both test-unit and test-acc output to the same `test-output.json`, so the acc run overwrote the unit run. Make each target write to a filename that matches it: - `make test-unit` -> `test-output-unit.json` - `make test-acc` -> `test-output-acc.json` Upload both as a single per-matrix-entry artifact so we can run `gotestsum tool slowest` or ad-hoc queries against the full per-test timing set. `make cover` (push-to-main path) is adjusted to match. Drop the `make slowest` workflow step -- the same analysis is available offline from the uploaded artifact, and we no longer hard-code a default `test-output.json` in `GOTESTSUM_CMD`. Co-authored-by: Isaac --- .github/workflows/push.yml | 13 +++++++++++-- Makefile | 14 +++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index fcd6930f64..82cd6e16c0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -146,8 +146,17 @@ jobs: ENVFILTER: DATABRICKS_BUNDLE_ENGINE=${{ matrix.deployment }} run: make cover - - name: Analyze slow tests - run: make slowest + - name: Upload gotestsum JSON output + # Always upload so we can inspect timing even if tests fail. + if: ${{ always() }} + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: test-output-${{ matrix.os.name }}-${{ matrix.deployment }} + path: | + test-output-unit.json + test-output-acc.json + if-no-files-found: warn + retention-days: 7 - name: Check out.test.toml files are up to date shell: bash diff --git a/Makefile b/Makefile index c763496ceb..a7c0c83d5f 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ ACCEPTANCE_TEST_FILTER = "" GO_TOOL ?= go tool -modfile=tools/go.mod GOTESTSUM_FORMAT ?= pkgname-and-test-fails -GOTESTSUM_CMD ?= ${GO_TOOL} gotestsum --format ${GOTESTSUM_FORMAT} --no-summary=skipped --jsonfile test-output.json --rerun-fails +GOTESTSUM_CMD ?= ${GO_TOOL} gotestsum --format ${GOTESTSUM_FORMAT} --no-summary=skipped --rerun-fails LOCAL_TIMEOUT ?= 30m @@ -79,11 +79,11 @@ test: test-unit test-acc .PHONY: test-unit test-unit: - ${GOTESTSUM_CMD} --packages "${TEST_PACKAGES}" -- -timeout=${LOCAL_TIMEOUT} + ${GOTESTSUM_CMD} --jsonfile=test-output-unit.json --packages "${TEST_PACKAGES}" -- -timeout=${LOCAL_TIMEOUT} .PHONY: test-acc test-acc: - ${GOTESTSUM_CMD} --packages ./acceptance/... -- -timeout=${LOCAL_TIMEOUT} -run ${ACCEPTANCE_TEST_FILTER} + ${GOTESTSUM_CMD} --jsonfile=test-output-acc.json --packages ./acceptance/... -- -timeout=${LOCAL_TIMEOUT} -run ${ACCEPTANCE_TEST_FILTER} # Updates acceptance test output (local tests) .PHONY: test-update @@ -108,15 +108,11 @@ test-update-aws: .PHONY: test-update-all test-update-all: test-update test-update-aws -.PHONY: slowest -slowest: - ${GO_TOOL} gotestsum tool slowest --jsonfile test-output.json --threshold 1s --num 50 - .PHONY: cover cover: rm -fr ./acceptance/build/cover/ - VERBOSE_TEST=1 ${GOTESTSUM_CMD} --packages "${TEST_PACKAGES}" -- -coverprofile=coverage.txt -timeout=${LOCAL_TIMEOUT} - VERBOSE_TEST=1 CLI_GOCOVERDIR=build/cover ${GOTESTSUM_CMD} --packages ./acceptance/... -- -timeout=${LOCAL_TIMEOUT} -run ${ACCEPTANCE_TEST_FILTER} + VERBOSE_TEST=1 ${GOTESTSUM_CMD} --jsonfile=test-output-unit.json --packages "${TEST_PACKAGES}" -- -coverprofile=coverage.txt -timeout=${LOCAL_TIMEOUT} + VERBOSE_TEST=1 CLI_GOCOVERDIR=build/cover ${GOTESTSUM_CMD} --jsonfile=test-output-acc.json --packages ./acceptance/... -- -timeout=${LOCAL_TIMEOUT} -run ${ACCEPTANCE_TEST_FILTER} rm -fr ./acceptance/build/cover-merged/ mkdir -p acceptance/build/cover-merged/ go tool covdata merge -i $$(printf '%s,' acceptance/build/cover/* | sed 's/,$$//') -o acceptance/build/cover-merged/