Skip to content

Commit

Permalink
Include advanced-reboot ptf exception in pytest assertion (sonic-net#…
Browse files Browse the repository at this point in the history
…12941)

What is the motivation for this PR?
Surface more information in our test reporting infrastructure to aid in debugging

How did you do it?
Added more information to a pytest assertion.

How did you verify/test it?
Artificially added an exception to the try-except block and saw that it was printed out in the pytest assertions.
  • Loading branch information
Ryangwaite authored and mssonicbld committed May 24, 2024
1 parent 11c2f33 commit 04d58f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/common/fixtures/advanced_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,9 @@ def runRebootTest(self):
self.postboot_setup()
except Exception:
traceback_msg = traceback.format_exc()
logger.error("Exception caught while running advanced-reboot test on ptf: \n{}".format(traceback_msg))
test_results[test_case_name].append("Exception caught while running advanced-reboot test on ptf")
err_msg = "Exception caught while running advanced-reboot test on ptf: \n{}".format(traceback_msg)
logger.error(err_msg)
test_results[test_case_name].append(err_msg)
finally:
# capture the test logs, and print all of them in case of failure, or a summary in case of success
log_dir = self.__fetchTestLogs(rebootOper)
Expand Down

0 comments on commit 04d58f3

Please sign in to comment.