diff options
author | Bastien Nocera <hadess@hadess.net> | 2022-07-24 17:47:43 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2022-07-24 19:52:49 +0200 |
commit | cecc08d8afde162558000cc62055c88a35605947 (patch) | |
tree | ca1d09ead280624cafebaaf1953397b18159320c | |
parent | 30316f99ee5c4c90e23c597a5482beea8519dd9e (diff) | |
download | accountsservice-cecc08d8afde162558000cc62055c88a35605947.tar.gz |
ci: Fail tests when some are skipped
We want to make sure all the tests are being run.
-rwxr-xr-x | .ci/fail_skipped_tests.py | 25 | ||||
-rw-r--r-- | .gitlab-ci.yml | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/.ci/fail_skipped_tests.py b/.ci/fail_skipped_tests.py new file mode 100755 index 0000000..6349921 --- /dev/null +++ b/.ci/fail_skipped_tests.py @@ -0,0 +1,25 @@ +#!/usr/bin/python3 + +from lxml import etree +import sys + +def format_title(title): + """Put title in a box""" + box = { + 'tl': '╔', 'tr': '╗', 'bl': '╚', 'br': '╝', 'h': '═', 'v': '║', + } + hline = box['h'] * (len(title) + 2) + + return '\n'.join([ + f"{box['tl']}{hline}{box['tr']}", + f"{box['v']} {title} {box['v']}", + f"{box['bl']}{hline}{box['br']}", + ]) + +tree = etree.parse(sys.argv[1]) +for suite in tree.xpath('/testsuites/testsuite'): + skipped = suite.get('skipped') + if int(skipped) != 0: + print(format_title('Tests were skipped when they should not have been. All the tests must be run in the CI'), + end='\n\n', flush=True) + sys.exit(1) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 80a5b17..5603605 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,6 +44,7 @@ test-fedora: - useradd -u 5555 -ms /bin/bash user - su user -c .ci/run-tests.sh - cp -r /home/user/accountsservice/_build/ ./ + - .ci/fail_skipped_tests.py _build/meson-logs/testlog.junit.xml - cat _build/meson-logs/coverage.txt artifacts: name: log-and-coverage |