Skip to content

Commit

Permalink
refactor: enhance override config masic test (#16226)
Browse files Browse the repository at this point in the history
Description of PR
Enhance the override_config_table/test_override_config_table_masic.py to make it compatible with the parallel run infra.

Summary:
Fixes # (issue) Microsoft ADO 30056122

Approach
What is the motivation for this PR?
We wanted to enable parallel run for override_config_table/test_override_config_table_masic.py, so we need to deprecate enum_upstream_dut_hostname.

How did you do it?
How did you verify/test it?
I ran the updated code and can confirm it's working as expected.

co-authorized by: [email protected]
  • Loading branch information
cyw233 authored and mssonicbld committed Jan 2, 2025
1 parent 04e565e commit 6e7dee1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/override_config_table/test_override_config_table_masic.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def setup_env(duthosts, tbinfo, enum_rand_one_per_hwsku_frontend_hostname):
restore_config(duthost, GOLDEN_CONFIG, GOLDEN_CONFIG_BACKUP)
else:
duthost.file(path=GOLDEN_CONFIG, state='absent')
# Restore config before test
config_reload(duthost)
# Restore config after test
config_reload(duthost, safe_reload=True)


def load_minigraph_with_golden_empty_input(duthost):
Expand Down Expand Up @@ -220,20 +220,29 @@ def load_minigraph_with_golden_empty_table_removal(duthost):
)


def test_load_minigraph_with_golden_config(duthosts, setup_env, tbinfo, enum_upstream_dut_hostname,
enum_rand_one_per_hwsku_frontend_hostname):
def is_upstream_t2_dut(duthost, tbinfo):
upstream_nbr_type = "T3"
minigraph_facts = duthost.get_extended_minigraph_facts(tbinfo)
minigraph_neighbors = minigraph_facts['minigraph_neighbors']
for key, value in minigraph_neighbors.items():
if upstream_nbr_type in value['name']:
return True

return False


def test_load_minigraph_with_golden_config(duthosts, setup_env, tbinfo, enum_rand_one_per_hwsku_frontend_hostname):
"""
Test Golden Config override during load minigraph
Note: Skip full config override for multi-asic duts for now, because we
don't have CLI to get new golden config that contains 'localhost' and 'asicxx'
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
duthost_up = duthosts[enum_upstream_dut_hostname]
if not duthost.is_multi_asic:
pytest.skip("Skip override-config-table multi-asic testing on single-asic platforms,\
test provided golden config format is not compatible with single-asics")
topo_type = tbinfo["topo"]["type"]
if topo_type == 't2' and duthost != duthost_up:
if topo_type == 't2' and not is_upstream_t2_dut(duthost, tbinfo):
# Skip empty golden-config testing on upstream linecards,
# since the handling of empty golden config doesn't work on upstream linecards
load_minigraph_with_golden_empty_input(duthost)
Expand Down

0 comments on commit 6e7dee1

Please sign in to comment.