-
Notifications
You must be signed in to change notification settings - Fork 61
Description
This surfaced in #820 (potentially due to the go version bump?).
We currently pipe all output from go test -json ... into the gotestfmt tool:
complement/.github/workflows/ci.yaml
Line 121 in 9d4a021
| ${{ matrix.env }} go test -v -json -tags "${{ matrix.tags }}" -timeout "${{ matrix.timeout }}" ./tests ./tests/csapi ${{ matrix.packages }} | .ci/scripts/gotestfmt |
If there's a problem with the test, it may emit something like:
Error: {"ImportPath":"github.com/matrix-org/complement/tests/csapi [github.com/matrix-org/complement/tests/csapi.test]","Action":"build-output","Output":"tests/csapi/ignored_users_test.go:55:11: non-constant format string in call to (*testing.common).Logf\n"}
instead of the usual:
{"Time":"2025-11-20T10:50:56.786423108Z","Action":"output","Package":"github.com/matrix-org/complement/tests","Test":"TestMSC4289PrivilegedRoomCreators_Upgrades","Output":" client.go:805: [CSAPI] POST hs1/_matrix/client/v3/join/!BDAhP0DZ5sVIHnOhxuAxN3v4kAMszvp0VaUAlsM2p-M =\u003e 200 OK (24.248184ms)\n"}
Note that the erroring log line doesn't contain a Package field.
gotestfmt chokes in this case, and outputs the cryptic error above. The only way to see the true error is to remove | gotestfmt from CI and re-run, grep'ing the logs for something like "Output":"tests/.
gotestfmt appears to be unmaintained since 2023. We may wish to fork upstream and fix the issue so such errors are presented cleanly, or choose a maintained alternative.