From 7ba95f2ff4a7990cd56e7577da6bdef6f1737a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Prchl=C3=ADk?= Date: Tue, 15 Oct 2024 14:04:37 +0200 Subject: [PATCH] Wait for guest connection before test restart Even without a reboot, tmt still needs to verify the guest is up and running. The reboot might be triggered beyond the control of tmt, and that is fine, we just need to be sure we restart the test on guest that's alive. Related to https://github.com/teemtee/tmt/issues/3284 --- tmt/steps/execute/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tmt/steps/execute/__init__.py b/tmt/steps/execute/__init__.py index 407b4ac096..86f4d64ba4 100644 --- a/tmt/steps/execute/__init__.py +++ b/tmt/steps/execute/__init__.py @@ -331,6 +331,15 @@ def handle_restart(self) -> bool: else: self._restart_count += 1 + # Even though the reboot was not requested, it might have + # still happened! Imagine a test configuring autoreboot on + # kernel panic plus a test restart. The reboot would happen + # beyond tmt's control, and tmt would try to restart the + # test, but the guest may be still booting. Make sure it's + # alive. + if not self.guest.reconnect(): + return False + self.logger.debug( f"Test restart during test '{self.test}'" f" with reboot count {self._reboot_count}"