Skip to content

Commit

Permalink
[dualtor] Fix snmp/* tests failure on fixture teardown (#15529)
Browse files Browse the repository at this point in the history
Approach
What is the motivation for this PR?
#15359 has introduced a "yield" statement inside the for loop of duthosts which is causing fixture teardown to fail with Failed: fixture function has more than one 'yield' message.

How did you do it?
Move "yield" statement out of this for loop of duthosts and do config rollback in a seperate for loop of duthosts.

How did you verify/test it?
Ran tests under snmp folder and tests are passing on Arista-7260CX3-D108C8 platform.

Any platform specific information?
  • Loading branch information
vkjammala-arista authored and mssonicbld committed Nov 15, 2024
1 parent 246a060 commit f00e65b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/snmp/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ def setup_check_snmp_ready(duthosts, localhost):
if 'LOCATION' not in snmp_location_redis_vals:
duthost.shell(f'sudo config snmp location add {yaml_snmp_location}') # set snmp cli

yield
yield

for duthost in duthosts:
# rollback configuration
rollback(duthost, SETUP_ENV_CP)

# remove snmp files downloaded
local_command = "find ./snmp/ -type f -name 'snmp.yml' -exec rm -f {} +"
localhost.shell(local_command)
# remove snmp files downloaded
local_command = "find ./snmp/ -type f -name 'snmp.yml' -exec rm -f {} +"
localhost.shell(local_command)


def extract_redis_keys(item):
Expand Down

0 comments on commit f00e65b

Please sign in to comment.