Skip to content

Commit

Permalink
[sonic-mgmt] Fix snmp/test_snmp_queue_counters.py teardown failure (s…
Browse files Browse the repository at this point in the history
…onic-net#15765)

* [sonic-mgmt] Fix snmp/test_snmp_queue_counters.py teardown failure

Use "enum_rand_one_per_hwsku_frontend_hostname" fixture in the "teardown" fixture
to derive the duthost name being used in the "test_snmp_queue_counters" method.
This fixes the issue of teardown/cleanup happening in the incorrect dut.

* Correct function docstring to reflect function parameters.
  • Loading branch information
vkjammala-arista authored and mssonicbld committed Nov 27, 2024
1 parent b1efd86 commit 576e1a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/snmp/test_snmp_queue_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ def test_snmp_queue_counters(duthosts,


@pytest.fixture(scope="module")
def teardown(duthost):
def teardown(duthosts, enum_rand_one_per_hwsku_frontend_hostname):
"""
Teardown procedure for all test function
:param duthost: DUT host object
:param duthosts: List of DUT hosts
:param enum_rand_one_per_hwsku_frontend_hostname: hostname of a randomly selected DUT
"""
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
yield
# Cleanup
duthost.copy(src=ORIG_CFG_DB, dest=CFG_DB_PATH, remote_src=True)
Expand Down

0 comments on commit 576e1a9

Please sign in to comment.