Skip to content

Commit 428b334

Browse files
authored
Treat failure to parse the previous run log file as a non-fatal error (#26343)
When using the `--failing-and-slow-first` flag on the CI, treat failure to parse the previous run log file as a non-fatal error, to help forcibly terminated CI jobs recover.
1 parent c93d8f6 commit 428b334

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

test/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ def load_previous_test_run_results():
101101
return json.load(open(PREVIOUS_TEST_RUN_RESULTS_FILE))
102102
except FileNotFoundError:
103103
return {}
104+
except json.decoder.JSONDecodeError as e:
105+
# It can happen on CI that the previous test run log file write is cut in
106+
# the middle if the build job is forcibly terminated at a bad moment,
107+
# leaving the log file as partial. Since the log file is used to sort tests
108+
# to a fast run order, it is not a catastrophic failure -> only log warning.
109+
logger.warning(f'Failed to open previous test run results: {e}')
110+
return {}
104111

105112

106113
def test_file(*path_components):

0 commit comments

Comments
 (0)