Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for SNMP Tests Flakiness #14945

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

agadia-cisco
Copy link
Contributor

Description of PR

Summary: The PR contains changes to snmp_helpers.py which checks whether snmp-subagent process is up or not before proceeding in the test. Accordingly all the snmp tests were updated to accommodate the change. This fixes the SNMP tests failures due to information not gathered in get_snmp_facts.

Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205
  • 202305
  • 202311
  • 202405

Approach

What is the motivation for this PR?

It has been observed that without snmp-subagent being up, SNMP tests proceeds to execution causing TC failures because snmp_facts isn't able to capture the device information.

How did you do it?

Check was added in snmp_helpers ensuring that snmp-subagent is up before calling snmp_facts. All TCs were updated with the change.

How did you verify/test it?

Had run the changes on 202405 image installed in T0 device & tests passed.

@mssonicbld
Copy link
Collaborator

The pre-commit check detected issues in the files touched by this pull request.
The pre-commit check is a mandatory check, please fix detected issues.

Detailed pre-commit check results:
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check for added large files..............................................Passed
check python ast.........................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

tests/common/helpers/snmp_helpers.py:37:121: E501 line too long (129 > 120 characters)
tests/common/helpers/snmp_helpers.py:38:21: E128 continuation line under-indented for visual indent

flake8...............................................(no files to check)Skipped
check conditional mark sort..........................(no files to check)Skipped

To run the pre-commit checks locally, you can follow below steps:

  1. Ensure that default python is python3. In sonic-mgmt docker container, default python is python2. You can run
    the check by activating the python3 virtual environment in sonic-mgmt docker container or outside of sonic-mgmt
    docker container.
  2. Ensure that the pre-commit package is installed:
sudo pip install pre-commit
  1. Go to repository root folder
  2. Install the pre-commit hooks:
pre-commit install
  1. Use pre-commit to check staged file:
pre-commit
  1. Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>

@agadia-cisco agadia-cisco marked this pull request as ready for review October 14, 2024 18:21
@vperumal
Copy link
Contributor

@abdosi @SuvarnaMeenakshi @yejianquan - Can you help review and merge this PR

@yejianquan
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

tests/common/helpers/snmp_helpers.py Outdated Show resolved Hide resolved
tests/common/helpers/snmp_helpers.py Outdated Show resolved Hide resolved
tests/common/helpers/snmp_helpers.py Outdated Show resolved Hide resolved
@yejianquan
Copy link
Collaborator

@agadia-cisco @vperumal , added comments, thanks

@yejianquan
Copy link
Collaborator

@agadia-cisco
Saw you test result in the collapsed comment, next time please paste the test result in the PR description,
And for the 2 failures in the output,
I believe they were here before your change and not related to your change, right?

@agadia-cisco
Copy link
Contributor Author

@agadia-cisco Saw you test result in the collapsed comment, next time please paste the test result in the PR description, And for the 2 failures in the output, I believe they were here before your change and not related to your change, right?

Both the failures are not related to my change & were seen before my changes too.

  • snmp/test_snmp_psu.py::test_snmp_numpsu failure, PR 14860 was already raised & it was merged today.
  • snmp/test_snmp_queue_counters.py::test_snmp_queue_counters failure, we are looking into the issue.

Copy link
Collaborator

@yejianquan yejianquan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yejianquan yejianquan merged commit c043990 into sonic-net:master Oct 30, 2024
15 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Oct 30, 2024
Description of PR
Summary: The PR contains changes to snmp_helpers.py which checks whether snmp-subagent process is up or not before proceeding in the test. Accordingly all the snmp tests were updated to accommodate the change. This fixes the SNMP tests failures due to information not gathered in get_snmp_facts.

Approach
What is the motivation for this PR?
It has been observed that without snmp-subagent being up, SNMP tests proceeds to execution causing TC failures because snmp_facts isn't able to capture the device information.

How did you do it?
Check was added in snmp_helpers ensuring that snmp-subagent is up before calling snmp_facts. All TCs were updated with the change.

How did you verify/test it?
Had run the changes on 202405 image installed in T0 device & tests passed.

co-authorized by: [email protected]
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202405: #15269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants