Skip to content

Commit 00a9f8a

Browse files
authored
Archive gotestsum JSON for unit and acc tests (#5068)
## Summary `task cover` (push-to-main path) wrote both the unit and acceptance gotestsum runs to the same `test-output.json`, so the acc run overwrote the unit run. Mirror what `task test` already does: - Each gotestsum run writes its own per-run JSON (`test-output-unit.json`, `test-output-acc.json`). - A trailing `cat` step concatenates them into `test-output.json`, so `task cover` and `task test` produce the same artifact. Upload `test-output.json` as a per-matrix-entry artifact (`test-output-<os>-<deployment>`) so we can run `gotestsum tool slowest` or ad-hoc queries against the full per-test timing set offline. This pull request and its description were written by Isaac.
1 parent 8e61912 commit 00a9f8a

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/push.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,15 @@ jobs:
153153
ENVFILTER: DATABRICKS_BUNDLE_ENGINE=${{ matrix.deployment }}
154154
run: go tool -modfile=tools/task/go.mod task cover
155155

156-
- name: Analyze slow tests
157-
run: go tool -modfile=tools/task/go.mod task slowest
156+
- name: Upload gotestsum JSON output
157+
# Always upload so we can inspect timing even if tests fail.
158+
if: ${{ always() }}
159+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
160+
with:
161+
name: test-output-${{ matrix.os.name }}-${{ matrix.deployment }}
162+
path: test-output.json
163+
if-no-files-found: warn
164+
retention-days: 7
158165

159166
- name: Check out.test.toml files are up to date
160167
run: |

Taskfile.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,24 +564,27 @@ tasks:
564564

565565
cover:
566566
desc: Run tests with coverage
567+
generates:
568+
- test-output.json
567569
cmds:
568570
- rm -fr ./acceptance/build/cover/
569571
- |
570572
VERBOSE_TEST=1 {{.GO_TOOL}} gotestsum \
571573
--format ${GOTESTSUM_FORMAT:-pkgname-and-test-fails} \
572574
--no-summary=skipped \
573-
--jsonfile test-output.json \
575+
--jsonfile test-output-unit.json \
574576
--rerun-fails \
575577
--packages "{{.TEST_PACKAGES}}" \
576578
-- -coverprofile=coverage.txt -timeout=${LOCAL_TIMEOUT:-30m}
577579
- |
578580
VERBOSE_TEST=1 CLI_GOCOVERDIR=build/cover {{.GO_TOOL}} gotestsum \
579581
--format ${GOTESTSUM_FORMAT:-pkgname-and-test-fails} \
580582
--no-summary=skipped \
581-
--jsonfile test-output.json \
583+
--jsonfile test-output-acc.json \
582584
--rerun-fails \
583585
--packages ./acceptance/... \
584586
-- -timeout=${LOCAL_TIMEOUT:-30m}{{if .ACCEPTANCE_TEST_FILTER}} -run "{{.ACCEPTANCE_TEST_FILTER}}"{{end}}
587+
- cat test-output-unit.json test-output-acc.json > test-output.json
585588
- rm -fr ./acceptance/build/cover-merged/
586589
- mkdir -p acceptance/build/cover-merged/
587590
- "go tool covdata merge -i $(printf '%s,' acceptance/build/cover/* | sed 's/,$//') -o acceptance/build/cover-merged/"

0 commit comments

Comments
 (0)