Skip to content
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

integrated reboot-cause history into reboot tests in platfrom_tests/test_reboot.py #8

Closed
wants to merge 1 commit into from

Conversation

JibinBao
Copy link
Owner

@JibinBao JibinBao commented Sep 10, 2021

Description of PR

Summary:
Fixes # (issue)
Since adding the feature(sonic-net/SONiC#669) of show reboot-cause history, so integrate "show reboot-cause history" into sonic-mgmt/tests/platform_tests/test_reboot.py.
e.g.

show reboot-cause history
Name                 Cause          Time                             User    Comment
-------------------  -------------  -------------------------------  ------  ---------
2021_09_09_14_15_13  Power Loss ()  N/A                              N/A     N/A
2021_09_09_14_06_17  reboot         Thu 09 Sep 2021 02:05:17 PM UTC  admin   N/A
2021_09_09_13_59_11  Watchdog ()    N/A                              N/A     N/A
2021_09_09_13_52_13  Power Loss ()  N/A                              N/A     N/A
2021_09_09_13_45_18  warm-reboot    Thu 09 Sep 2021 01:44:14 PM UTC  admin   N/A
2021_09_09_13_37_58  fast-reboot    Thu 09 Sep 2021 01:37:09 PM UTC  admin   N/A
2021_09_09_13_30_52  soft-reboot    Thu 09 Sep 2021 01:30:24 PM UTC  admin   N/A
2021_09_09_13_24_17  reboot         Thu 09 Sep 2021 01:23:17 PM UTC  admin   N/A

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911

Approach

What is the motivation for this PR?

In order to verify reboot-cause history function, add new checker for "show reboot-cause history" into reboot tests

How did you do it?

Add one new function of check_reboot_cause_history in sonic-mgmt/tests/platform_tests/test_reboot.py.
In test_reboot.py, there are 8 different reboot tests. In order to save test execution time, we leverage the reboot-cause history generated by them to test it.

  1. Verify the reboot-cause history title
  2. Verify reboot-cause output are sorted in reverse chronological order

How did you verify/test it?

run test_reboot.py

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

sonic-net/SONiC#669

@JibinBao JibinBao changed the title add reboot-cause history into reboot tests in platfrom_test add reboot-cause history into reboot tests in platfrom_tests/test_reboot.py Sep 10, 2021
@JibinBao JibinBao changed the title add reboot-cause history into reboot tests in platfrom_tests/test_reboot.py integrated reboot-cause history into reboot tests in platfrom_tests/test_reboot.py Sep 10, 2021
logging.debug("Check reboot-cause history title")
if reboot_cause_history_got:
if not set(REBOOT_CAUSE_HISTORY_TITLE) == set(reboot_cause_history_got[0].keys()):
logging.debug("Expected reboot-cause history:{} not match actual reboot-cause history:{}".format(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this log always be printed to give users a hint about the failure reason? Same comments to the below two debug logging.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will change it to error level

@JibinBao JibinBao force-pushed the add_reboot_cause_history_platform branch from 034f9f7 to f8100cc Compare September 13, 2021 04:11
@JibinBao
Copy link
Owner Author

open external PR

@JibinBao JibinBao closed this Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants