sonic-mgmt
sonic-mgmt copied to clipboard
Add test case for syslog rate limit feature
HLD: https://github.com/sonic-net/SONiC/pull/1049
Change-Id: I11f29fa1a2265e2ba8c9a4ea4bac6ed2a0bb5a25
Description of PR
Add test case for syslog rate limit feature.
Summary: test_syslog_rate_limit_container
- Randomly choose on container
- Change the syslog rate limit of current container
- Use a generated script to print log from current container which is fast enough to hit the limit
- Check syslog that some logs are dropped
test_syslog_rate_limit_host
- Change the syslog rate limit of host
- Use a generated script to print log from host which is fast enough to hit the limit
- Check syslog that some logs are dropped
Type of change
- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [x] Test case(new/improvement)
Back port request
- [ ] 201911
- [ ] 202012
- [ ] 202205
Approach
What is the motivation for this PR?
Add test case for syslog rate limit feature
How did you do it?
Add test case for syslog rate limit feature
How did you verify/test it?
Run the test case
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation
The pre-commit check detected issues in the files touched by this pull request. The detected issues may be old or new. For new issues, please try to fix them.
For old issues, it is not mandatory to fix them because they were not caused by this change. It is unfair to blame author of this pull request. But if you can take extra effort to fix the old issues as well, that would be great!
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/syslog/test_syslog_rate_limit.py:58:121: E501 line too long (143 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:60:121: E501 line too long (130 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:116:121: E501 line too long (124 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:122:121: E501 line too long (146 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:124:121: E501 line too long (185 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:125:121: E501 line too long (170 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:127:121: E501 line too long (130 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:129:45: E128 continuation line under-indented for visual indent
tests/syslog/test_syslog_rate_limit.py:130:45: E128 continuation line under-indented for visual indent
tests/syslog/test_syslog_rate_limit.py:130:121: E501 line too long (148 > 120 characters)
tests/syslog/test_syslog_rate_limit.py:131:45: E128 continuation line under-indented for visual indent
...
[truncated extra lines, please run pre-commit locally to view full check results]
To run the pre-commit checks locally, you can follow below steps:
- 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.
- Ensure that the
pre-commit
package is installed:
sudo pip install pre-commit
- Go to repository root folder
- Install the pre-commit hooks:
pre-commit install
- Use pre-commit to check staged file:
pre-commit
- Alternatively, you can check committed files using:
pre-commit run --from-ref <commit_id> --to-ref <commit_id>
/azpw run Azure.sonic-mgmt
/AzurePipelines run Azure.sonic-mgmt
Azure Pipelines successfully started running 1 pipeline(s).
Hi @wangxin, i have replied to your comment, would you please check if it addressed your comment?
@Junchao-Mellanox could we move forward merging this one now that the feature PRs are all in? or should we wait for some submodule updates?