From 20441caca99f7ecc25cd9f9c814f422e7edb7733 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 14 Dec 2022 17:32:45 +0000 Subject: [PATCH 1/5] ci: Prevent early exit on gotestsum failure --- .github/workflows/coder.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 009b35fe6b5cc..046836580b2df 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -338,6 +338,7 @@ jobs: else echo ::set-output name=cover::false fi + set +e gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS ret=$? if ((ret)); then @@ -423,6 +424,7 @@ jobs: - name: Test with PostgreSQL Database run: | + set +e make test-postgres ret=$? if ((ret)); then From d0a3e50252f1b9674d36a18b5426a12903337a91 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 14 Dec 2022 17:57:28 +0000 Subject: [PATCH 2/5] test: Shorten timeout to cause failure --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 046836580b2df..bbd504a03ddc2 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -339,7 +339,7 @@ jobs: echo ::set-output name=cover::false fi set +e - gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS + gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=30s -short -failfast $COVERAGE_FLAGS ret=$? if ((ret)); then # Eternalize test timeout logs because "re-run failed" erases From 07b87e636e1452c731f1e4f8958b687bfafd8335 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 14 Dec 2022 18:12:33 +0000 Subject: [PATCH 3/5] ci: Explicitly capture gotestsum edge case before cat, only output trace --- .github/workflows/coder.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index bbd504a03ddc2..95643c2736fd9 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -345,8 +345,11 @@ jobs: # 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 + testWithStack=$(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)') + if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then + echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:" + grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json + fi fi exit $ret @@ -431,8 +434,11 @@ jobs: # 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 + testWithStack=$(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)') + if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then + echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:" + grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json + fi fi exit $ret From 236dbd832d019ad0982d6e98aa23f7d57ec9d4e1 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 14 Dec 2022 18:51:27 +0000 Subject: [PATCH 4/5] ci: Multiple packages can have their own stack --- .github/workflows/coder.yaml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 95643c2736fd9..23f5dc2c88e74 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -345,11 +345,14 @@ jobs: # Eternalize test timeout logs because "re-run failed" erases # artifacts and gotestsum doesn't always capture it: # https://github.com/gotestyourself/gotestsum/issues/292 - testWithStack=$(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)') - if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then - echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:" - grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json - fi + # Multiple test packages could've failed, each one may or may + # not run into the edge case. PS. Don't summon ShellCheck here. + for testWithStack in $(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)'); do + if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then + echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:" + grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json + fi + done fi exit $ret @@ -434,11 +437,14 @@ jobs: # Eternalize test timeout logs because "re-run failed" erases # artifacts and gotestsum doesn't always capture it: # https://github.com/gotestyourself/gotestsum/issues/292 - testWithStack=$(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)') - if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then - echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:" - grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json - fi + # Multiple test packages could've failed, each one may or may + # not run into the edge case. PS. Don't summon ShellCheck here. + for testWithStack in $(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)'); do + if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then + echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:" + grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json + fi + done fi exit $ret From d36d23225cdd8d41e91764855124ce678f858583 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Thu, 15 Dec 2022 10:35:54 +0000 Subject: [PATCH 5/5] Revert "test: Shorten timeout to cause failure" This reverts commit d0a3e50252f1b9674d36a18b5426a12903337a91. --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 23f5dc2c88e74..e0c83abc85166 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -339,7 +339,7 @@ jobs: echo ::set-output name=cover::false fi set +e - gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=30s -short -failfast $COVERAGE_FLAGS + gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS ret=$? if ((ret)); then # Eternalize test timeout logs because "re-run failed" erases