From c4682c0a1fb877e69ebf23306396d051aa7c2eca Mon Sep 17 00:00:00 2001 From: Michael Wiencek Date: Thu, 16 Jan 2025 11:30:26 -0600 Subject: [PATCH] Fix "Checking translation domain in statistics code" test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. The `!` negation does not actually cause the script to exit (despite `set -e`) if the `git grep` succeeds (finds matches). See [1]: "The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command’s return status is being inverted with !." Thus I've replaced the `!` at the beginning of the command with `&& { exit 1; }` at the end. 2. It appears that the tests could hang on the `git grep` command if it produced too many matches due to the results being paged. I've also added the `--no-pager` flag to resolve this. [1] https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html: --- docker/musicbrainz-tests/run_circleci_tests.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/musicbrainz-tests/run_circleci_tests.sh b/docker/musicbrainz-tests/run_circleci_tests.sh index 84f4ce0b758..8128fb410aa 100755 --- a/docker/musicbrainz-tests/run_circleci_tests.sh +++ b/docker/musicbrainz-tests/run_circleci_tests.sh @@ -40,7 +40,9 @@ sudo -E -H -u musicbrainz ./node_modules/.bin/eslint --max-warnings 0 . echo OK echo Checking translation domain in statistics code -! sudo -E -H -u musicbrainz git grep -Pw '(N_)?l[np]?\(' -- 'root/statistics/**.js' +sudo -E -H -u musicbrainz \ + git --no-pager grep -Pw '(N_)?l[np]?\(' -- 'root/statistics/**.js' \ + && { exit 1; } echo OK sv_start_if_down chrome