ci/lava: Parametrize message burst length on unit tests
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

We can have jobs with a lower job timeout values, given by
CI_JOB_TIMEOUT environment variable, such as the pytest ones.

The previously hardcoded burst length of 1000 messages at a simulated
rate of 1 msg/sec caused tests to exceed these timeouts and fail
unexpectedly on specific job timeouts.

Reported-by: Eric Engestrom <eric@igalia.com>
Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34907>
This commit is contained in:
Guilherme Gallo 2025-05-09 13:51:41 -03:00 committed by Marge Bot
parent e7f6b4bdae
commit e9e98d997d
2 changed files with 11 additions and 3 deletions

View file

@ -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,
)

View file

@ -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,
),