Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tests/common/plugins/sanity_check/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _find_down_ports(dut, phy_interfaces, ip_interfaces):
def check_interfaces(duthosts):
def _check():
check_results = []
for dut in duthosts:
for dut in duthosts.frontend_nodes:
logger.info("Checking interfaces status on %s..." % dut.hostname)

networking_uptime = dut.get_networking_uptime().seconds
Expand Down Expand Up @@ -161,7 +161,7 @@ def _check():
def check_bgp(duthosts):
def _check():
check_results = []
for dut in duthosts:
for dut in duthosts.frontend_nodes:
def _check_bgp_status_helper():
asic_check_results = []
bgp_facts = dut.bgp_facts(asic_index='all')
Expand Down
16 changes: 16 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,3 +880,19 @@ def duthost_console(localhost, creds, request):
console_password=creds['console_password'][vars['console_type']])
yield host
host.disconnect()

@pytest.fixture(scope='session')
def cleanup_cache_for_session(request):
"""
This fixture allows developers to cleanup the cached data for all DUTs in the testbed before test.
Use cases:
- Running tests where some 'facts' about the DUT that get cached are changed.
- Running tests/regression without running test_pretest which has a test to clean up cache (PR#2978)
- Test case development phase to work out testbed information changes.

This fixture is not automatically applied, if you want to use it, you have to add a call to it in your tests.
"""
tbname, tbinfo = get_tbinfo(request)
cache.cleanup(zone=tbname)
for a_dut in tbinfo['duts']:
cache.cleanup(zone=a_dut)