Skip to content

Commit

Permalink
Fix with_stripped_logs to propagate the exit code
Browse files Browse the repository at this point in the history
Summary:
We have been using with_stripped_logs more to clean up the output of tests.

Unfortunately it strips the exit code, which can make debugging harder on failure. Annoingly, it also makes it hard to add to existing tests.

Fix the issue.

Reviewed By: clara-9

Differential Revision: D68948386

fbshipit-source-id: 701a34f2827e4e69e03729f1be431cce5dfcf3e6
  • Loading branch information
andreacampi authored and facebook-github-bot committed Jan 31, 2025
1 parent 6f69ff3 commit baf2042
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
inconsistent value of *, but 'meg-mon' bookmark points to None (glob)
inconsistent value of *, but 'meg-mon' bookmark points to None (glob)
Error: found 2 inconsistencies

[1]

-- use verify-bookmarks, but passing a regex.
$ with_stripped_logs crossrepo_verify_bookmarks 2 0 --update-large-repo-bookmarks \
Expand All @@ -80,6 +80,7 @@
> --no-bookmark-updates
found 2 inconsistencies, trying to update them...
Error: Missing outcome for * from small repo (glob)
[1]

-- sync the missing commits
$ with_stripped_logs mononoke_x_repo_sync 2 0 once --bookmark-regex ".+bookmark"
Expand Down
2 changes: 2 additions & 0 deletions eden/mononoke/tests/integration/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ function strip_glog {

function with_stripped_logs {
"$@" 2>&1 | strip_glog
# propagate the exit status, otherwise the test will happily continue on failure
return "${PIPESTATUS[0]}"
}

function wait_for_json_record_count {
Expand Down
3 changes: 2 additions & 1 deletion eden/mononoke/tests/integration/test-library-unit-tests.t
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@
plain
output

# with_stripped_logs doesn't propagate the exit code correctly
# with_stripped_logs *will* propagate the exit code correctly
$ with_stripped_logs mononoke_admin invalid
error: unrecognized subcommand 'invalid'

Usage: admin [OPTIONS] <--config-path <CONFIG_PATH>|--config-tier <CONFIG_TIER>|--prod|--git-config> <COMMAND>

For more information, try '--help'.
[2]


0 comments on commit baf2042

Please sign in to comment.