-
Notifications
You must be signed in to change notification settings - Fork 850
[chassis] accomodate test_memory_exhaustion.py if random dut is chassis sup #9075
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
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
77d2074
Update test_memory_exhaustion.py
wenyiz2021 27c7eab
Update test_memory_exhaustion.py
wenyiz2021 430b8d6
Update test_memory_exhaustion.py
wenyiz2021 9f61aa7
fix pre-commit
wenyiz2021 322b678
Update processes_utils.py
wenyiz2021 9f55b7d
Update test_memory_exhaustion.py
wenyiz2021 53a3b38
Update test_memory_exhaustion.py
wenyiz2021 0ba2f2f
Update test_memory_exhaustion.py
wenyiz2021 d5d1df2
Update processes_utils.py
wenyiz2021 8505fe6
Update test_memory_exhaustion.py
wenyiz2021 e097213
Update test_memory_exhaustion.py
wenyiz2021 1a3aff3
Update test_memory_exhaustion.py
wenyiz2021 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
from tests.common.helpers.assertions import pytest_assert | ||
from tests.common.platform.processes_utils import wait_critical_processes | ||
from tests.common.reboot import SONIC_SSH_PORT, SONIC_SSH_REGEX | ||
from tests.common.reboot import SONIC_SSH_PORT, SONIC_SSH_REGEX, wait_for_startup | ||
|
||
pytestmark = [ | ||
pytest.mark.disable_loganalyzer, | ||
|
@@ -24,7 +24,8 @@ class TestMemoryExhaustion: | |
""" | ||
|
||
@pytest.fixture(autouse=True) | ||
def tearDown(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, pdu_controller): | ||
def tearDown(self, duthosts, enum_rand_one_per_hwsku_hostname, | ||
localhost, pdu_controller,): | ||
yield | ||
# If the SSH connection is not established, or any critical process is exited, | ||
# try to recover the DUT by PDU reboot. | ||
|
@@ -41,6 +42,12 @@ def tearDown(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, pdu_co | |
'Recover {} by PDU reboot failed'.format(hostname)) | ||
# Wait until all critical processes are healthy. | ||
wait_critical_processes(duthost) | ||
# For sup, we also need to ensure linecards are back and healthy for following tests | ||
is_sup = duthost.get_facts().get("modular_chassis") and duthost.is_supervisor_node() | ||
if is_sup: | ||
for lc in duthosts.frontend_nodes: | ||
wait_for_startup(lc, localhost, delay=10, timeout=300) | ||
wait_critical_processes(lc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we write commmon function for this code, it is being used couple time here may be useful in other tests as well |
||
|
||
def test_memory_exhaustion(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost): | ||
duthost = duthosts[enum_rand_one_per_hwsku_hostname] | ||
|
@@ -68,6 +75,11 @@ def test_memory_exhaustion(self, duthosts, enum_rand_one_per_hwsku_hostname, loc | |
'DUT {} did not startup'.format(hostname)) | ||
# Wait until all critical processes are healthy. | ||
wait_critical_processes(duthost) | ||
is_sup = duthost.get_facts().get("modular_chassis") and duthost.is_supervisor_node() | ||
if is_sup: | ||
for lc in duthosts.frontend_nodes: | ||
wait_for_startup(lc, localhost, delay=10, timeout=300) | ||
wait_critical_processes(lc) | ||
# Verify DUT uptime is later than the time when the test case started running. | ||
dut_uptime = duthost.get_up_time() | ||
pytest_assert(dut_uptime > dut_datetime, "Device {} did not reboot".format(hostname)) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove extra comma at end #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also fix the line indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the comma.
Indentation is correct I believe:
sonic-mgmt/tests/platform_tests/api/test_sfp.py
Line 37 in 9d6c0de