From 28079addd355f1de722ff7db5383e1a3da128c17 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 14 Dec 2022 12:23:01 +0000 Subject: [PATCH 1/2] ci: Output tail of `gotestsum.json` if test timed out This is to eternalize the log in case "re-run failed" is used, which erases artifacts from previous run. --- .github/workflows/coder.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index a5bb412ebc67e..8032c086d4144 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -338,8 +338,16 @@ jobs: else echo ::set-output name=cover::false fi - set -x gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=3m -short -failfast $COVERAGE_FLAGS + ret=$? + if ((ret)); then + # Eternalize test timeout logs because "re-run failed" erases + # artifacts and gotestsum doesn't always capture it: + # https://github.com/gotestyourself/gotestsum/issues/292 + echo "Checking gotestsum.json for panic trace:" + grep -A 999999 'panic: test timed out' gotestsum.json + fi + exit $ret - uses: actions/upload-artifact@v3 if: success() || failure() From c8a73117e0ee035a0355c45edbea88e27ca37268 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 14 Dec 2022 12:31:29 +0000 Subject: [PATCH 2/2] ci: Add outputting to postgres test as well --- .github/workflows/coder.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 8032c086d4144..4772af329eb5e 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -415,7 +415,17 @@ jobs: terraform_wrapper: false - name: Test with PostgreSQL Database - run: make test-postgres + run: | + make test-postgres + ret=$? + if ((ret)); then + # Eternalize test timeout logs because "re-run failed" erases + # artifacts and gotestsum doesn't always capture it: + # https://github.com/gotestyourself/gotestsum/issues/292 + echo "Checking gotestsum.json for panic trace:" + grep -A 999999 'panic: test timed out' gotestsum.json + fi + exit $ret - uses: actions/upload-artifact@v3 if: success() || failure()