Skip to content

Commit 713aa7e

Browse files
Hide successful, skipped Complement tests in the CI (#19590)
Co-authored-by: Eric Eastwood <erice@element.io>
1 parent 40d699b commit 713aa7e

5 files changed

Lines changed: 24 additions & 28 deletions

File tree

.ci/complement_package.gotpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ which is under the Unlicense licence.
2929
{{- with .TestCases -}}
3030
{{- /* Passing tests are first */ -}}
3131
{{- range . -}}
32-
{{- if eq .Result "PASS" -}}
32+
{{- if and (eq .Result "PASS") (not $settings.HideSuccessfulTests) -}}
3333
::group::{{ "\033" }}[0;32m✅{{ " " }}{{- .Name -}}
3434
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
3535
{{- with .Coverage -}}
@@ -49,7 +49,8 @@ which is under the Unlicense licence.
4949

5050
{{- /* Then skipped tests are second */ -}}
5151
{{- range . -}}
52-
{{- if eq .Result "SKIP" -}}
52+
{{- /* Skipped tests are also purposefully hidden if "HideSuccessfulTests" is enabled */ -}}
53+
{{- if and (eq .Result "SKIP") (not $settings.HideSuccessfulTests) -}}
5354
::group::{{ "\033" }}[0;33m🚧{{ " " }}{{- .Name -}}
5455
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
5556
{{- with .Coverage -}}

.ci/scripts/gotestfmt

Lines changed: 0 additions & 21 deletions
This file was deleted.

.ci/scripts/setup_complement_prerequisites.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ alias block='{ set +x; } 2>/dev/null; func() { echo "::group::$*"; set -x; }; fu
1010
alias endblock='{ set +x; } 2>/dev/null; func() { echo "::endgroup::"; set -x; }; func'
1111

1212
block Install Complement Dependencies
13-
sudo apt-get -qq update && sudo apt-get install -qqy libolm3 libolm-dev
1413
go install -v github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
1514
endblock
1615

.github/workflows/tests.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,12 @@ jobs:
744744
- name: Formatted sanity check Complement test logs
745745
# Always run this step if we attempted to run the Complement tests.
746746
if: always() && steps.run_sanity_check_complement_image_test.outcome != 'skipped'
747+
# We do not hide successful tests in `gotestfmt` here as the list of sanity
748+
# check tests is so short. Feel free to change this when we get more tests.
749+
#
750+
# Note that the `-hide` argument is interpreted by `gotestfmt`. From it,
751+
# it derives several values under `$settings` and passes them to our
752+
# custom `.ci/complement_package.gotpl` template to render the output.
747753
run: cat /tmp/gotest-sanity-check-complement.log | gotestfmt -hide "successful-downloads,empty-packages"
748754

749755
- name: Run Complement Tests
@@ -764,10 +770,15 @@ jobs:
764770
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
765771
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
766772

767-
- name: Formatted Complement test logs
773+
- name: Formatted Complement test logs (only failing are shown)
768774
# Always run this step if we attempted to run the Complement tests.
769775
if: always() && steps.run_complement_tests.outcome != 'skipped'
770-
run: cat /tmp/gotest-complement.log | gotestfmt -hide "successful-downloads,empty-packages"
776+
# Hide successful tests in order to reduce the verbosity of the otherwise very large output.
777+
#
778+
# Note that the `-hide` argument is interpreted by `gotestfmt`. From it,
779+
# it derives several values under `$settings` and passes them to our
780+
# custom `.ci/complement_package.gotpl` template to render the output.
781+
run: cat /tmp/gotest-complement.log | gotestfmt -hide "successful-downloads,successful-tests,empty-packages"
771782

772783
- name: Run in-repo Complement Tests
773784
id: run_in_repo_complement_tests
@@ -787,10 +798,15 @@ jobs:
787798
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
788799
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
789800

790-
- name: Formatted in-repo Complement test logs
801+
- name: Formatted in-repo Complement test logs (only failing are shown)
791802
# Always run this step if we attempted to run the Complement tests.
792803
if: always() && steps.run_in_repo_complement_tests.outcome != 'skipped'
793-
run: cat /tmp/gotest-in-repo-complement.log | gotestfmt -hide "successful-downloads,empty-packages"
804+
# Hide successful tests in order to reduce the verbosity of the otherwise very large output.
805+
#
806+
# Note that the `-hide` argument is interpreted by `gotestfmt`. From it,
807+
# it derives several values under `$settings` and passes them to our
808+
# custom `.ci/complement_package.gotpl` template to render the output.
809+
run: cat /tmp/gotest-in-repo-complement.log | gotestfmt -hide "successful-downloads,successful-tests,empty-packages"
794810

795811
cargo-test:
796812
if: ${{ needs.changes.outputs.rust == 'true' }}

changelog.d/19590.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Only show failing Complement tests in the formatted output in CI.

0 commit comments

Comments
 (0)