From 7540df4282fde8682a88958b59dd404d39f153b3 Mon Sep 17 00:00:00 2001 From: Markus Alexander Kuppe Date: Wed, 28 Aug 2024 00:52:22 -0700 Subject: [PATCH] Ensure raft traces are always uploaded as workflow artifacts. (#6451) Signed-off-by: Markus Alexander Kuppe --- .github/workflows/tlaplus.yml | 2 +- tests/raft_scenarios_runner.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tlaplus.yml b/.github/workflows/tlaplus.yml index 6644bc7204f9..d44297352a48 100644 --- a/.github/workflows/tlaplus.yml +++ b/.github/workflows/tlaplus.yml @@ -250,7 +250,7 @@ jobs: - name: Upload artifacts. uses: actions/upload-artifact@v4 - if: ${{ failure() }} + if: always() with: name: tlc path: | diff --git a/tests/raft_scenarios_runner.py b/tests/raft_scenarios_runner.py index 1761244f0e44..3208024efd20 100644 --- a/tests/raft_scenarios_runner.py +++ b/tests/raft_scenarios_runner.py @@ -169,12 +169,14 @@ def expand_files(files): with block(ostream, "diagram", 3, "mermaid", ["sequenceDiagram"]): ostream.write(mermaid) - with open( - os.path.join(output_dir, f"{os.path.basename(scenario)}.ndjson"), - "w", - encoding="utf-8", - ) as f: - f.write(log) + ## Do not create an empty ndjson file if log is emtpy. + if log: + with open( + os.path.join(output_dir, f"{os.path.basename(scenario)}.ndjson"), + "w", + encoding="utf-8", + ) as f: + f.write(log) write_error_report(err_list)