Skip to content

Commit

Permalink
Improve the timeout fail reason
Browse files Browse the repository at this point in the history
When the test is interrupted because of timeout we use `fail_reason`
message as `Runner error occurred:`. IMO such message can mislead the
user to problem with runner. Let's update this message to more correct
`Test interrupted:`

Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja committed Nov 9, 2023
1 parent 2f2cef5 commit cf16632
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion avocado/core/task/statemachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ async def _send_finished_tasks_message(self, terminate_tasks, reason):
task_id = str(terminated_task.task.identifier)
job_id = terminated_task.task.job_id
log_message = messages.LogMessage.get(
f"{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())} | Runner error occurred: {reason}",
f"{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())} | Test interrupted: {reason}",
id=task_id,
job_id=job_id,
)
Expand Down
4 changes: 2 additions & 2 deletions selftests/functional/job_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ def _check_timeout_msg(self, idx):
debug_log_paths = glob.glob(os.path.join(res_dir, f"{idx}-*", "debug.log"))
debug_log = genio.read_file(debug_log_paths[0])
self.assertIn(
"Runner error occurred: Timeout reached",
"Test interrupted: Timeout reached",
debug_log,
(
f"Runner error occurred: Timeout reached message not "
f"Test interrupted: Timeout reached message not "
f"in the {idx}st test's debug.log:\n{debug_log}"
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ def test_timeout(self):
result = process.run(cmd_line, ignore_status=True)
self.assertEqual(result.exit_status, AVOCADO_JOB_INTERRUPTED)
self.assertIn(
"examples/tests/timeouttest.py:TimeoutTest.test: INTERRUPTED: timeout",
"examples/tests/timeouttest.py:TimeoutTest.test: INTERRUPTED: Test interrupted: Timeout reached",
result.stdout_text,
)

0 comments on commit cf16632

Please sign in to comment.