From fe773aa4b72ce66a38d3033144d5b9659aad4976 Mon Sep 17 00:00:00 2001 From: Jan Richter Date: Mon, 17 Jul 2023 14:10:49 +0200 Subject: [PATCH] Avocado-instrumented default timeout removal This will remove unsystematic timeout inside avocado-instrumented runner. This timeout has been set to 24 hours and users haven't had a way how to change it. Because we solved problems with `task.timeout.running` in #5383 and `job-timeout` in #5295 this default timeout is not needed anymore. After this change, the users will have more power over timeouts and will be able to run instrumented tests longer than 24 hours. Reference: #5394 Signed-off-by: Jan Richter --- avocado/plugins/runners/avocado_instrumented.py | 6 ++---- .../plugin/runners/avocado_instrumented.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 selftests/functional/plugin/runners/avocado_instrumented.py diff --git a/avocado/plugins/runners/avocado_instrumented.py b/avocado/plugins/runners/avocado_instrumented.py index 593710a910..f3db717ce9 100644 --- a/avocado/plugins/runners/avocado_instrumented.py +++ b/avocado/plugins/runners/avocado_instrumented.py @@ -42,8 +42,6 @@ class and method names should be separated by a ":". One "job.run.store_logging_stream", ] - DEFAULT_TIMEOUT = 86400 - @staticmethod def _create_params(runnable): """Create params for the test""" @@ -145,7 +143,7 @@ def run(self, runnable): time_started = time.monotonic() - timeout = float(self.DEFAULT_TIMEOUT) + timeout = float("inf") next_status_time = None while True: time.sleep(RUNNER_RUN_CHECK_INTERVAL) @@ -161,7 +159,7 @@ def run(self, runnable): else: message = queue.get() if message.get("type") == "early_state": - timeout = float(message.get("timeout") or self.DEFAULT_TIMEOUT) + timeout = float(message.get("timeout") or float("inf")) else: yield message if message.get("status") == "finished": diff --git a/selftests/functional/plugin/runners/avocado_instrumented.py b/selftests/functional/plugin/runners/avocado_instrumented.py new file mode 100644 index 0000000000..97fca8a24a --- /dev/null +++ b/selftests/functional/plugin/runners/avocado_instrumented.py @@ -0,0 +1,16 @@ +from avocado import Test +from avocado.utils import process +from selftests.utils import AVOCADO, TestCaseTmpDir + + +class AvocadoInstrumentedRunnerTest(TestCaseTmpDir, Test): + def test_timeout(self): + cmd_line = ( + f"{AVOCADO} run --job-results-dir {self.tmpdir.name} " + f"-- examples/tests/timeouttest.py " + ) + result = process.run(cmd_line, ignore_status=True) + self.assertIn( + "examples/tests/timeouttest.py:TimeoutTest.test: INTERRUPTED: timeout", + result.stdout_text, + )