-
Notifications
You must be signed in to change notification settings - Fork 679
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
Issue #3754: Modify AAA config commands to use pass_db decorator #3755
Open
anders-nexthop
wants to merge
1
commit into
sonic-net:master
Choose a base branch
from
anders-nexthop:fix_aaa_unit_tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
6b7905f
to
5bcf718
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
5bcf718
to
1fb0d9f
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
1fb0d9f
to
63cd10d
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
63cd10d
to
e66caa0
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
* Convert AAA config comamnds to use the pass_db decorator pattern * Remove manual db manipulation from AAA/Radius tests so that they test actual config command behavior * Modify some expected test output based on what config commands actually produce * Add/update test cases which were missing coverage
e66caa0
to
6d966c8
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
I filled in some missing test cases to pass the code coverage threshold. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
Currently all AAA config commands create a new
ConfigDBConnector
object for every operation. This doesn't interact well with the pytest mock infrastructure used in the unit tests. I changed the AAA config commands to accept aConfigDBConnector
from the top-level command, which follows the standard pattern used by other config commands (such as those in sonic-utilities/config/main.py).I fixed up tests so that they actually test config functionality, instead of manually manipulating the mock DB to return valid show results.
Some expected output in tests was not in line with actual product output. I updated the expected output in these cases.
fixes #3754
How I did it
Convert AAA config commands to use the pass_db decorator pattern, which is used by most other commands in sonic-utilities. This decorator allows the ConfigDBConnector to be passed in directly.
I went through sonic-utilities/tests/aaa_test.py and sonic-utilities/tests/radius_test.py, and removed all instances where manual database manipulation was being done unnecessarily (such as here, for example).
How to verify it
Removing the db modification from the AAA tests causes them to fail before my changes. After my changes, all AAA tests pass.