Skip to content

Commit

Permalink
Fix "Checking translation domain in statistics code" test
Browse files Browse the repository at this point in the history
 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:
  • Loading branch information
mwiencek committed Jan 16, 2025
1 parent 0e9808a commit c4682c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker/musicbrainz-tests/run_circleci_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c4682c0

Please sign in to comment.