ci/lava: Don't print LAVA debug messages

Remove debug messages from the output in order to unclutter the log a
little more for the developers.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16323>
This commit is contained in:
Guilherme Gallo 2022-06-30 18:41:14 -03:00 committed by Marge Bot
parent 466917ea4c
commit 29af421272
2 changed files with 1 additions and 57 deletions

View File

@ -329,36 +329,15 @@ def fix_lava_gitlab_section_log(line):
line["msg"] = f"\x1b[0K{marker}:{timestamp}:{id_collapsible}\r\x1b[0K{header}"
def filter_debug_messages(line: dict[str, str]) -> bool:
"""Filter some LAVA debug messages that does not add much information to the
developer and may clutter the trace log."""
if line["lvl"] != "debug":
return False
# line["msg"] can be a list[str] when there is a kernel dump
if not isinstance(line["msg"], str):
return False
if re.match(
# Sometimes LAVA dumps this messages lots of times when the LAVA job is
# reaching the end.
r"^Listened to connection for namespace",
line["msg"],
):
return True
return False
def parse_lava_line(line) -> Optional[str]:
prefix = ""
suffix = ""
if line["lvl"] in ["results", "feedback"]:
if line["lvl"] in ["results", "feedback", "debug"]:
return
elif line["lvl"] in ["warning", "error"]:
prefix = CONSOLE_LOG["COLOR_RED"]
suffix = CONSOLE_LOG["RESET"]
elif filter_debug_messages(line):
return
elif line["lvl"] == "input":
prefix = "$ "
suffix = ""

View File

@ -31,7 +31,6 @@ from lava.utils.lava_log import (
GitlabSection,
LogFollower,
LogSectionType,
filter_debug_messages,
fix_lava_color_log,
fix_lava_gitlab_section_log,
hide_sensitive_data,
@ -250,40 +249,6 @@ def test_fix_lava_gitlab_section_log(message, fixed_message):
assert message["msg"] == fixed_message
LAVA_DEBUG_SPAM_MESSAGES = {
"Listened to connection in debug level": (
create_lava_yaml_msg(
msg="Listened to connection for namespace 'common' for up to 1s",
lvl="debug",
),
True,
),
"Listened to connection in debug level - v2": (
create_lava_yaml_msg(
msg="Listened to connection for namespace 'prepare' for up to 9s",
lvl="debug",
),
True,
),
"Listened to connection in target level": (
create_lava_yaml_msg(
msg="Listened to connection for namespace 'common' for up to 1s",
lvl="target",
),
False,
),
}
@pytest.mark.parametrize(
"message, expectation",
LAVA_DEBUG_SPAM_MESSAGES.values(),
ids=LAVA_DEBUG_SPAM_MESSAGES.keys(),
)
def test_filter_debug_messages(message, expectation):
assert filter_debug_messages(message) == expectation
WATCHDOG_SCENARIOS = {
"1 second before timeout": ({"seconds": -1}, does_not_raise()),
"1 second after timeout": ({"seconds": 1}, pytest.raises(MesaCITimeoutError)),