Skip to content
Snippets Groups Projects
Unverified Commit 4f6de33f authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Print complement failure results last (#13639)

Since github always scrolls to the bottom of any test output, let's put the
failed tests last and hide any successful packages.
parent c4e29b69
No related branches found
No related tags found
No related merge requests found
...@@ -27,10 +27,10 @@ which is under the Unlicense licence. ...@@ -27,10 +27,10 @@ which is under the Unlicense licence.
{{- . -}}{{- "\n" -}} {{- . -}}{{- "\n" -}}
{{- end -}} {{- end -}}
{{- with .TestCases -}} {{- with .TestCases -}}
{{- /* Failing tests are first */ -}} {{- /* Passing tests are first */ -}}
{{- range . -}} {{- range . -}}
{{- if and (ne .Result "PASS") (ne .Result "SKIP") -}} {{- if eq .Result "PASS" -}}
::group::{{ "\033" }}[0;31m❌{{ " " }}{{- .Name -}} ::group::{{ "\033" }}[0;32m✅{{ " " }}{{- .Name -}}
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}} {{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
{{- with .Coverage -}} {{- with .Coverage -}}
, coverage: {{ . }}% , coverage: {{ . }}%
...@@ -47,7 +47,6 @@ which is under the Unlicense licence. ...@@ -47,7 +47,6 @@ which is under the Unlicense licence.
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- /* Then skipped tests are second */ -}} {{- /* Then skipped tests are second */ -}}
{{- range . -}} {{- range . -}}
{{- if eq .Result "SKIP" -}} {{- if eq .Result "SKIP" -}}
...@@ -68,11 +67,10 @@ which is under the Unlicense licence. ...@@ -68,11 +67,10 @@ which is under the Unlicense licence.
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- /* and failing tests are last */ -}}
{{- /* Then passing tests are last */ -}}
{{- range . -}} {{- range . -}}
{{- if eq .Result "PASS" -}} {{- if and (ne .Result "PASS") (ne .Result "SKIP") -}}
::group::{{ "\033" }}[0;32m✅{{ " " }}{{- .Name -}} ::group::{{ "\033" }}[0;31m❌{{ " " }}{{- .Name -}}
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}} {{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
{{- with .Coverage -}} {{- with .Coverage -}}
, coverage: {{ . }}% , coverage: {{ . }}%
......
#!/bin/bash
#
# wraps `gotestfmt`, hiding output from successful packages unless
# all tests passed.
set -o pipefail
set -e
# tee the test results to a log, whilst also piping them into gotestfmt,
# telling it to hide successful results, so that we can clearly see
# unsuccessful results.
tee complement.log | gotestfmt -hide successful-packages
# gotestfmt will exit non-zero if there were any failures, so if we got to this
# point, we must have had a successful result.
echo "All tests successful; showing all test results"
# Pipe the test results back through gotestfmt, showing all results.
# The log file consists of JSON lines giving the test results, interspersed
# with regular stdout lines (including reports of downloaded packages).
grep '^{"Time":' complement.log | gotestfmt
...@@ -163,7 +163,7 @@ jobs: ...@@ -163,7 +163,7 @@ jobs:
- run: | - run: |
set -o pipefail set -o pipefail
TEST_ONLY_IGNORE_POETRY_LOCKFILE=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt TEST_ONLY_IGNORE_POETRY_LOCKFILE=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | synapse/.ci/scripts/gotestfmt
shell: bash shell: bash
name: Run Complement Tests name: Run Complement Tests
......
...@@ -354,7 +354,7 @@ jobs: ...@@ -354,7 +354,7 @@ jobs:
- run: | - run: |
set -o pipefail set -o pipefail
POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | synapse/.ci/scripts/gotestfmt
shell: bash shell: bash
name: Run Complement Tests name: Run Complement Tests
......
...@@ -137,7 +137,7 @@ jobs: ...@@ -137,7 +137,7 @@ jobs:
- run: | - run: |
set -o pipefail set -o pipefail
TEST_ONLY_SKIP_DEP_HASH_VERIFICATION=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt TEST_ONLY_SKIP_DEP_HASH_VERIFICATION=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | synapse/.ci/scripts/gotestfmt
shell: bash shell: bash
name: Run Complement Tests name: Run Complement Tests
......
Improve readability of Complement CI logs by printing failure results last.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment