Skip to content

Commit

Permalink
tests: Add docker/dmesg logs in after_case for CLH test
Browse files Browse the repository at this point in the history
Collect journalctl docker logs and dmesg log for CLH test
under after_case

Sometime, we miss the dmesg logs because of serial console
as we collect dmesg only if serial console is not there.
For baremetal run, serail console logs are not whole and
we miss the logs.

Signed-off-by: Smit Gardhariya <[email protected]>
  • Loading branch information
smit-gardhariya committed Jun 10, 2024
1 parent 95c09ff commit d045132
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion microsoft/testsuites/cloud_hypervisor/ch_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from lisa.operating_system import CBLMariner, Ubuntu
from lisa.testsuite import TestResult
from lisa.tools import Ls, Lscpu, Modprobe, Usermod
from lisa.tools import Dmesg, Journalctl, Ls, Lscpu, Modprobe, Usermod
from lisa.util import SkippedException
from microsoft.testsuites.cloud_hypervisor.ch_tests_tool import CloudHypervisorTests

Expand Down Expand Up @@ -47,6 +47,17 @@ def after_case(self, log: Logger, **kwargs: Any) -> None:
node = kwargs["node"]
node.tools[Modprobe].remove(["openvswitch"])

journalctl = node.tools[Journalctl]
docker_log = journalctl.logs_for_unit(
unit_name="docker",
sudo=True,
)
log.debug(f"Journalctl Docker Logs: {docker_log}")

dmesg = node.tools[Dmesg]
dmesg_log = dmesg.get_output(force_run=True)
log.debug(f"Dmesg Logs: {dmesg_log}")

@TestCaseMetadata(
description="""
Runs cloud-hypervisor integration tests.
Expand Down

0 comments on commit d045132

Please sign in to comment.