-
Notifications
You must be signed in to change notification settings - Fork 732
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
add retry_call to test_platform_info mock check #3684
add retry_call to test_platform_info mock check #3684
Conversation
@slutati1536 Can you address the PR testing issue:
|
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the test failure caused by this change. Thanks!
…o_test_platform_info_mock_check
@ jleveque could you please review so this PR can be merged? |
@keboliu , @Junchao-Mellanox and @wangxin kindly reminder please review and check if your comments were all addressed |
…o_test_platform_info_mock_check
@wangxin could you please help to review |
@@ -7,6 +7,7 @@ | |||
import json | |||
import logging | |||
import time | |||
from retry.api import retry_call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a new dependency is introduced here: https://pypi.org/project/retry/
Is there a way to avoid this dependency?
If not, can you update the sonic-mgmt Dockerfile in the sonic-buildimage repo to include installation of this retry package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't notice that it has been added to the sonic-mgmt image in PR sonic-net/sonic-buildimage#7997. LGTM then.
sonic-net#3684)" Revert "add retry_call to test_platform_info mock check (sonic-net#3684)" Reverted commit `734fda3d`.
What is the motivation for this PR? The test case "test_thermal_control_fan_status" will failed after the PR #3684 is merged How did you do it? Change the return value of the check_result in AbnormalFanMocker, before the #3684 is merged, it dose not care about the return value of the check_result in AbnormalFanMocker, after the PR is merged, it will check the return value of the check_result How did you verify/test it? Run test cases in test_platform_info.py and all the test cases pass
What is the motivation for this PR? The test case "test_thermal_control_fan_status" will failed after the PR sonic-net#3684 is merged How did you do it? Change the return value of the check_result in AbnormalFanMocker, before the sonic-net#3684 is merged, it dose not care about the return value of the check_result in AbnormalFanMocker, after the PR is merged, it will check the return value of the check_result How did you verify/test it? Run test cases in test_platform_info.py and all the test cases pass
Description of PR
the following cases:
are executing a command once and comparing the output to the expected mock data,
sometimes differences between the mock and the actual are causing the tests to fail. retry will make these tests more robust since those failures are very hard to reproduce and also they rarely happen.
Summary:
add retries to test in order to make them more stable
Type of change
Back port request
Approach
What is the motivation for this PR?
those cases sometimes fail because of mock data mismatch, for example:
actual: {
},
expected:
"PSU-1 Temp": {
},
retry will compare the actual info several times before failing, making the tests more stable.
How did you do it?
add my changes and tested them locally to check nothing was broken
How did you verify/test it?
run the cases locally
Any platform specific information?
no