From 576e1a9de106d4a32b3add4a793bdd71bdf9c075 Mon Sep 17 00:00:00 2001 From: vkjammala-arista <152394203+vkjammala-arista@users.noreply.github.com> Date: Wed, 27 Nov 2024 19:28:00 +0530 Subject: [PATCH] [sonic-mgmt] Fix snmp/test_snmp_queue_counters.py teardown failure (#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. --- tests/snmp/test_snmp_queue_counters.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/snmp/test_snmp_queue_counters.py b/tests/snmp/test_snmp_queue_counters.py index 03160e8dba..dab8fcbf49 100644 --- a/tests/snmp/test_snmp_queue_counters.py +++ b/tests/snmp/test_snmp_queue_counters.py @@ -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)