Skip to content

[advance-reboot] Add timeout to reboot cases #4532

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 2 commits into from
Oct 22, 2021
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
38 changes: 25 additions & 13 deletions tests/common/fixtures/advanced_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
HOST_MAX_COUNT = 126
TIME_BETWEEN_SUCCESSIVE_TEST_OPER = 420
PTFRUNNER_QLEN = 1000
REBOOT_CASE_TIMEOUT = 1800

class AdvancedReboot:
'''
Expand Down Expand Up @@ -422,22 +423,26 @@ def imageInstall(self, prebootList=None, inbootList=None, prebootFiles=None):
def runRebootTest(self):
# Run advanced-reboot.ReloadTest for item in preboot/inboot list
count = 0
result = True
final_result = True
for rebootOper in self.rebootData['sadList']:
count += 1
try:
self.__setupRebootOper(rebootOper)
result = self.__runPtfRunner(rebootOper)
self.__verifyRebootOper(rebootOper)
except Exception:
result = False
finally:
# always capture the test logs
self.__fetchTestLogs(rebootOper)
self.__clearArpAndFdbTables()
self.__revertRebootOper(rebootOper)
if not result:
return result
final_result = False
if len(self.rebootData['sadList']) > 1 and count != len(self.rebootData['sadList']):
time.sleep(TIME_BETWEEN_SUCCESSIVE_TEST_OPER)
return result
return final_result

def runRebootTestcase(self, prebootList=None, inbootList=None, prebootFiles=None):
'''
Expand Down Expand Up @@ -531,17 +536,24 @@ def __runPtfRunner(self, rebootOper=None):
self.__updateAndRestartArpResponder(rebootOper)

logger.info('Run advanced-reboot ReloadTest on the PTF host')
result = ptf_runner(
self.ptfhost,
"ptftests",
"advanced-reboot.ReloadTest",
qlen=PTFRUNNER_QLEN,
platform_dir="ptftests",
platform="remote",
params=params,
log_file=u'/tmp/advanced-reboot.ReloadTest.log',
module_ignore_errors=self.moduleIgnoreErrors
)
try:
result = ptf_runner(
self.ptfhost,
"ptftests",
"advanced-reboot.ReloadTest",
qlen=PTFRUNNER_QLEN,
platform_dir="ptftests",
platform="remote",
params=params,
log_file=u'/tmp/advanced-reboot.ReloadTest.log',
module_ignore_errors=self.moduleIgnoreErrors,
timeout=REBOOT_CASE_TIMEOUT
)
except Exception as err:
logger.error("Timed out after {}s of executing advance reboot case: {}.".format(
REBOOT_CASE_TIMEOUT, str(rebootOper)) + ". Error message: {}".format(err.message))
raise Exception

return result

def __restorePrevImage(self):
Expand Down