diff --git a/.gitlab-ci/lava/utils/__init__.py b/.gitlab-ci/lava/utils/__init__.py index e2388bb6808..f4d4f997145 100644 --- a/.gitlab-ci/lava/utils/__init__.py +++ b/.gitlab-ci/lava/utils/__init__.py @@ -15,4 +15,8 @@ from .log_section import ( FALLBACK_GITLAB_SECTION_TIMEOUT, LogSection, LogSectionType, + CI_JOB_TIMEOUT_MIN, + LAVA_TEST_OVERHEAD_MIN, + LAVA_TEST_CASE_TIMEOUT, + LAVA_TEST_SUITE_TIMEOUT, ) diff --git a/.gitlab-ci/tests/test_lava_job_submitter.py b/.gitlab-ci/tests/test_lava_job_submitter.py index f4846b3b073..4df2c8014f3 100644 --- a/.gitlab-ci/tests/test_lava_job_submitter.py +++ b/.gitlab-ci/tests/test_lava_job_submitter.py @@ -26,7 +26,7 @@ from lava.lava_job_submitter import ( retriable_follow_job, wait_for_job_get_started, ) -from lava.utils import LogSectionType +from lava.utils import LogSectionType, LAVA_TEST_CASE_TIMEOUT from .lava.helpers import ( generate_n_logs, @@ -40,6 +40,10 @@ from .lava.helpers import ( NUMBER_OF_MAX_ATTEMPTS = NUMBER_OF_RETRIES_TIMEOUT_DETECTION + 1 +def max_sec_before_timeout(): + return min(1000, LAVA_TEST_CASE_TIMEOUT * 60 - 1) + + @pytest.fixture def mock_proxy_waiting_time(mock_proxy): def update_mock_proxy(frozen_time, **kwargs): @@ -104,7 +108,7 @@ PROXY_SCENARIOS = { LogSectionType.TEST_CASE: [ section_timeout(LogSectionType.TEST_CASE) + 1 ] - * 1000 + * max_sec_before_timeout() }, result="fail", exit_code=1, @@ -166,7 +170,7 @@ PROXY_SCENARIOS = { ), "long log case, no silence": ( mock_logs( - messages={LogSectionType.TEST_CASE: [1] * (1000)}, + messages={LogSectionType.TEST_CASE: [1] * (max_sec_before_timeout())}, result="pass", exit_code=0, ),