Skip to content

[advanced-reboot] Set timeout for reboot test to prevent hung tests #5365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tests/common/fixtures/advanced_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from tests.common.helpers.sad_path import SadOperation
from tests.ptf_runner import ptf_runner
from tests.common.helpers.assertions import pytest_assert
from tests.common.utilities import InterruptableThread

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -448,9 +449,21 @@ def runRebootTest(self):
pre_reboot_analysis, post_reboot_analysis = self.advanceboot_loganalyzer
marker = pre_reboot_analysis()
self.__setupRebootOper(rebootOper)
result = self.__runPtfRunner(rebootOper)
thread = InterruptableThread(
target=self.__runPtfRunner,
kwargs={"rebootOper": rebootOper})
thread.daemon = True
thread.start()
# give the test REBOOT_CASE_TIMEOUT (1800s) to complete the reboot with IO,
# and then additional 300s to examine the pcap, logs and generate reports
ptf_timeout = REBOOT_CASE_TIMEOUT + 300
thread.join(timeout=ptf_timeout, suppress_exception=True)
self.ptfhost.shell("pkill -f 'ptftests advanced-reboot.ReloadTest'", module_ignore_errors=True)
# the thread might still be running, and to catch any exceptions after pkill allow 10s to join
thread.join(timeout=10)
self.__verifyRebootOper(rebootOper)
except Exception:
logger.error("Exception caught while running advanced-reboot test on ptf")
failed_list.append(rebootOper)
finally:
# always capture the test logs
Expand Down