-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[staticroutebfd] fix an error in error logging #17043
[staticroutebfd] fix an error in error logging #17043
Conversation
Fix an error in the log_err call. this error can be triggered by an invalid static route key. usually the code cannot go here with normal config file. but hit this issue with an invalid key by manual testing with redis-cli directly. the file is scanned by Python lint to prevent such errors.
Yes. I will check if I can use mocked function to test this logging issue. ===================================================================================================================================== FAILURES =====================================================================================================================================
_________________________________________________________________________________________________________________________________ test_invalid_key _________________________________________________________________________________________________________________________________
...
tests/test_static_rt_bfd.py:180:
...
if not valid:
> log_err("invalid ip prefix for static route: ", key)
E TypeError: log_err() takes 1 positional argument but 2 were given
staticroutebfd/main.py:379: TypeError UT passed with the fix. |
add UT for an invalid key logging issue.
LGTM. @StormLiangMS can you help with merge of this. |
required in 202305/202311 |
@abdosi , MS ADO? |
updated. |
Why I did it Fix an error in the log_err call. this error can be triggered by an invalid static route key. usually the code cannot go here with normal config file. but hit this issue with an invalid key by manual testing with redis-cli directly. the file is scanned by Python lint to prevent such errors. Work item tracking Microsoft ADO ():26250268 How I did it fix the format error. How to verify it 1, ran pylint to check the design, make sure no such error in the design file. 2, wrote a separate python program to verify the log call. In the current logging related testing, usually use patch/mock for logging. for this specific error, could not trigger it if we call mock function instead the real function in the design. so need to do lint checking for code change.
Cherry-pick PR to 202305: #17961 |
Why I did it Fix an error in the log_err call. this error can be triggered by an invalid static route key. usually the code cannot go here with normal config file. but hit this issue with an invalid key by manual testing with redis-cli directly. the file is scanned by Python lint to prevent such errors. Work item tracking Microsoft ADO ():26250268 How I did it fix the format error. How to verify it 1, ran pylint to check the design, make sure no such error in the design file. 2, wrote a separate python program to verify the log call. In the current logging related testing, usually use patch/mock for logging. for this specific error, could not trigger it if we call mock function instead the real function in the design. so need to do lint checking for code change.
Why I did it Fix an error in the log_err call. this error can be triggered by an invalid static route key. usually the code cannot go here with normal config file. but hit this issue with an invalid key by manual testing with redis-cli directly. the file is scanned by Python lint to prevent such errors. Work item tracking Microsoft ADO ():26250268 How I did it fix the format error. How to verify it 1, ran pylint to check the design, make sure no such error in the design file. 2, wrote a separate python program to verify the log call. In the current logging related testing, usually use patch/mock for logging. for this specific error, could not trigger it if we call mock function instead the real function in the design. so need to do lint checking for code change.
Cherry-pick PR to 202311: #17985 |
Why I did it Fix an error in the log_err call. this error can be triggered by an invalid static route key. usually the code cannot go here with normal config file. but hit this issue with an invalid key by manual testing with redis-cli directly. the file is scanned by Python lint to prevent such errors. Work item tracking Microsoft ADO ():26250268 How I did it fix the format error. How to verify it 1, ran pylint to check the design, make sure no such error in the design file. 2, wrote a separate python program to verify the log call. In the current logging related testing, usually use patch/mock for logging. for this specific error, could not trigger it if we call mock function instead the real function in the design. so need to do lint checking for code change.
Why I did it
Fix an error in the log_err call.
this error can be triggered by an invalid static route key. usually the code cannot go here with normal config file. but hit this issue with an invalid key by manual testing with redis-cli directly. the file is scanned by Python lint to prevent such errors.
Work item tracking
How I did it
fix the format error.
How to verify it
1, ran pylint to check the design, make sure no such error in the design file.
2, wrote a separate python program to verify the log call.
In the current logging related testing, usually use patch/mock for logging. for this specific error, could not trigger it if we call mock function instead the real function in the design. so need to do lint checking for code change.
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)