Skip to content

Commit

Permalink
Better failure reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoura committed May 9, 2021
1 parent 7f2e33c commit e6aab1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions .buildkite/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ reports_dir="$tests_repo/.reports"

get_coverage() {
if [ ! -e "$tests_repo/.cli_coverage" ] || ! hash cardano-cli; then
return
return 1
fi
oldpwd="$PWD"
cd "$tests_repo"
retval=0
PYTHONPATH="$PWD:$PYTHONPATH" cardano_node_tests/cardano_cli_coverage.py \
-i .cli_coverage/cli_coverage_* \
-o "$1"
-i .cli_coverage/cli_coverage_* -o "$1" || retval=1
cd "$oldpwd"
return "$retval"
}

allure_report_dir="$tests_repo/allure-report"
Expand All @@ -27,4 +28,4 @@ allure generate "$reports_dir" -o "$allure_report_dir" --clean
echo "Creating report archive $tests_repo/allure-report.tar.bz2"
tar -C "$tests_repo" -cjf "$tests_repo/allure-report.tar.bz2" allure-report
echo "Generating CLI coverage report to $tests_repo/cli_coverage.json"
get_coverage "$tests_repo/cli_coverage.json"
get_coverage "$tests_repo/cli_coverage.json" || : > "$tests_repo/cli_coverage.json"
2 changes: 1 addition & 1 deletion cardano_node_tests/cardano_cli_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def main() -> int:
"cardano-cli": get_available_commands(["cardano-cli"], ignore_skips=args.ignore_skips)
}
try:
coverage = get_coverage(args.input_files, available_commands)
coverage = get_coverage(input_jsons=args.input_files, available_commands=available_commands)
except AttributeError as exc:
LOGGER.error(str(exc))
return 1
Expand Down
6 changes: 3 additions & 3 deletions cardano_node_tests/utils/cluster_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,14 @@ def _restart(self, start_cmd: str = "", stop_cmd: str = "") -> bool: # noqa: C9
excp = None
if i > 0:
self.cm._locked_log(
f"c{self.cm.cluster_instance}: failed to start cluster, retrying"
f"c{self.cm.cluster_instance}: failed to start cluster:\n{excp}\nretrying"
)
time.sleep(0.2)

try:
cluster_nodes.stop_cluster(cmd=str(startup_files.stop_script))
except Exception:
pass
except Exception as err:
self.cm._locked_log(f"c{self.cm.cluster_instance}: failed to stop cluster:\n{err}")

self._restart_save_cluster_artifacts(clean=True)
try:
Expand Down

0 comments on commit e6aab1c

Please sign in to comment.