From a40aef085db094b9ea3ceee1ba87e21d7c56f6d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Mon, 7 Oct 2024 15:04:07 +0200 Subject: [PATCH] squash: fix tests --- tests/execute/restraint/tmt-abort/test.sh | 5 ++++- tmt/result.py | 3 ++- tmt/steps/report/html/template.html.j2 | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/execute/restraint/tmt-abort/test.sh b/tests/execute/restraint/tmt-abort/test.sh index 3080efdb9c..a4ca7cff0b 100755 --- a/tests/execute/restraint/tmt-abort/test.sh +++ b/tests/execute/restraint/tmt-abort/test.sh @@ -14,8 +14,11 @@ rlJournalStart rlAssertNotGrep "This test should not be executed." $rlRun_LOG rlAssertNotGrep "This should not be executed either." $rlRun_LOG + rlAssertGrep "result: error" "${run}/plan/execute/results.yaml" - rlAssertGrep "note: aborted" "${run}/plan/execute/results.yaml" + rlAssertEquals "results should record the test aborted" \ + "$(yq -r '.[] | .note | join(", ")' ${run}/plan/execute/results.yaml)" \ + "beakerlib: State 'started', aborted" rlPhaseEnd rlPhaseStartCleanup diff --git a/tmt/result.py b/tmt/result.py index 16b75e155b..2b94cc42de 100644 --- a/tmt/result.py +++ b/tmt/result.py @@ -177,7 +177,8 @@ class BaseResult(SerializableContainer): unserialize=ResultOutcome.from_spec ) note: list[str] = field( - default_factory=cast(Callable[[], list[str]], list)) + default_factory=cast(Callable[[], list[str]], list), + unserialize=lambda value: [] if value is None else value) log: list[Path] = field( default_factory=cast(Callable[[], list[Path]], list), serialize=lambda logs: [str(log) for log in logs], diff --git a/tmt/steps/report/html/template.html.j2 b/tmt/steps/report/html/template.html.j2 index bb65387806..c7ee14796c 100644 --- a/tmt/steps/report/html/template.html.j2 +++ b/tmt/steps/report/html/template.html.j2 @@ -266,7 +266,7 @@ Context: {% endfor %} data - {% if result.note %}{{ result.note | e }}{% else %}-{% endif %} + {% if result.note %}{{ result.printable_note | e }}{% else %}-{% endif %} {% if result.check %}