ci/lava: A few formatting cleanups

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28778>
This commit is contained in:
Guilherme Gallo 2024-04-11 18:49:27 -03:00 committed by Marge Bot
parent 13093ceb3c
commit 5363874676
2 changed files with 6 additions and 19 deletions

View file

@ -58,7 +58,7 @@ except ImportError as e:
# Timeout in seconds to decide if the device from the dispatched LAVA job has
# hung or not due to the lack of new log output.
DEVICE_HANGING_TIMEOUT_SEC = int(getenv("DEVICE_HANGING_TIMEOUT_SEC", 5*60))
DEVICE_HANGING_TIMEOUT_SEC = int(getenv("DEVICE_HANGING_TIMEOUT_SEC", 5 * 60))
# How many seconds the script should wait before try a new polling iteration to
# check if the dispatched LAVA job is running or waiting in the job queue.
@ -182,7 +182,6 @@ def is_job_hanging(job, max_idle_time):
def parse_log_lines(job, log_follower, new_log_lines):
if log_follower.feed(new_log_lines):
# If we had non-empty log data, we can assure that the device is alive.
job.heartbeat()
@ -200,7 +199,6 @@ def parse_log_lines(job, log_follower, new_log_lines):
def fetch_new_log_lines(job):
# The XMLRPC binary packet may be corrupted, causing a YAML scanner error.
# Retry the log fetching several times before exposing the error.
for _ in range(5):
@ -509,7 +507,6 @@ class StructuredLoggerWrapper:
def logger_context(self):
context = contextlib.nullcontext()
try:
global STRUCTURAL_LOG
STRUCTURAL_LOG = StructuredLogger(
self.__submitter.structured_log_file, truncate=True

View file

@ -83,7 +83,7 @@ def lava_job_submitter(
def test_submit_and_follow_respects_exceptions(mock_sleep, mock_proxy, exception):
with pytest.raises(MesaCIException):
proxy = mock_proxy(side_effect=exception)
job = LAVAJob(proxy, '')
job = LAVAJob(proxy, "")
log_follower = bootstrap_log_follower()
follow_job_execution(job, log_follower)
@ -165,21 +165,13 @@ PROXY_SCENARIOS = {
mock_logs(result="pass"),
does_not_raise(),
"pass",
{
"testsuite_results": [
generate_testsuite_result(result="pass")
]
},
{"testsuite_results": [generate_testsuite_result(result="pass")]},
),
"no retries, but testsuite fails": (
mock_logs(result="fail"),
does_not_raise(),
"fail",
{
"testsuite_results": [
generate_testsuite_result(result="fail")
]
},
{"testsuite_results": [generate_testsuite_result(result="fail")]},
),
"no retries, one testsuite fails": (
generate_n_logs(n=1, tick_fn=0, result="fail"),
@ -188,7 +180,7 @@ PROXY_SCENARIOS = {
{
"testsuite_results": [
generate_testsuite_result(result="fail"),
generate_testsuite_result(result="pass")
generate_testsuite_result(result="pass"),
]
},
),
@ -438,9 +430,7 @@ def test_job_combined_status(
"lava.lava_job_submitter.retriable_follow_job"
) as mock_retriable_follow_job, patch(
"lava.lava_job_submitter.LAVAJobSubmitter._LAVAJobSubmitter__prepare_submission"
) as mock_prepare_submission, patch(
"sys.exit"
):
) as mock_prepare_submission, patch("sys.exit"):
from lava.lava_job_submitter import STRUCTURAL_LOG
mock_retriable_follow_job.return_value = MagicMock(status=finished_job_status)