ci: Capture panic stack traces
The short
formatting option for gotestsum
will suppress panics and their backtraces, making it harder to understand why a test failed. Using standard-verbose
will display the full trace, but this also gives us the full output of go test -v
, removing the readability improvements that gotestsum
provides.
This MR captures the panic output for use in CI job traces as after_script
and injects it into the job output in a pre-collapsed customer section. To do this, we add a TEST_FULL_OUTPUT
variable to the Makefile as the target for gotestsum --jsonfile
, which will write the full output of go test -json
. By default this is /dev/null
, but in the test template for CI jobs we override this to /tmp/test-output.log
, which we then parse to find panics.
See https://gitlab.com/gitlab-org/gitaly/-/jobs/2533330041 for example output.