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
snmp v2 tests in Light #3211
snmp v2 tests in Light #3211
Conversation
Build SUCCESS |
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.
@norberttak I have started reviewing this branch.
I have opened a new branch in my fork where I give some ideas how SNMP testcases should look like.
https://github.com/mitzkia/syslog-ng/tree/micek_fix_snmp_test2_branch
- main remarks:
- there were a lot of string variables in testcases (which are repeated through other testcases), which I refactorized out. It was hard to read testcases with them.
- there were small testcase content issues, where testcase name does not matched with testcase internal actions
- I have removed some unnecessary items from testcases (file_source, keep_hostname=yes). I have replaced file_source with example_msg_generator where message generation is automatic.
- I have separated testcases into smaller directories
Thanks, if you have any question, I am happy to answer.
Build SUCCESS |
Build SUCCESS |
Build SUCCESS |
Build SUCCESS |
@mitzkia : I did all the modifications you requested (your commit has been cherry picked + some minor modifications on it). |
Build SUCCESS |
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.
Finally I would squash all 'functional_tests/destination_drivers/snmp_destination/' testcase commits into one commit (for now there is commit with testcase diffs)
...ests/destination_drivers/snmp_destination/general/test_snmp_destination_reload_statistics.py
Outdated
Show resolved
Hide resolved
...ests/destination_drivers/snmp_destination/general/test_snmp_destination_reload_statistics.py
Outdated
Show resolved
Hide resolved
...ests/destination_drivers/snmp_destination/general/test_snmp_destination_reload_statistics.py
Outdated
Show resolved
Hide resolved
tests/python_functional/src/syslog_ng_config/statements/destinations/snmp_destination.py
Outdated
Show resolved
Hide resolved
Build FAILURE |
@kira-syslogng retest this please |
Build SUCCESS |
Colud you please fix the git commit messages, there are 'fixup' string in some cases. |
|
Build SUCCESS |
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.
Nice PR, thanks for this :)
...ional_tests/destination_drivers/snmp_destination/general/test_snmp_destination_acceptance.py
Show resolved
Hide resolved
...ests/destination_drivers/snmp_destination/general/test_snmp_destination_reload_statistics.py
Outdated
Show resolved
Hide resolved
...s/destination_drivers/snmp_destination/v2c/test_snmp_destination_v2c_using_macro_snmp_obj.py
Show resolved
Hide resolved
Build SUCCESS |
bcbc65d
to
8ec4bce
Compare
Build SUCCESS |
Build SUCCESS |
Build SUCCESS |
assert snmp_destination.get_stats() == {'written': message_counter, 'processed': message_counter, 'dropped': 0, 'queued': 0} | ||
|
||
syslog_ng.reload(config) | ||
message_counter += 1 # example_msg_generator source generates a new message on reload |
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.
Note: This is kinda misleading, comment and code here suggest 1 message, while from functional point of view it is message_counter
number of messages generated, which in this case happens to be one.
The better pattern imho would be not to use the same variable (as they are relativly free) wtih both configuring the source and the expected messages.
message_counter = 1
expected_message_counter = message_counter
...
syslog-ng.start(config)
expected_message_counter += message_counter # example msg_generator source generates the messages after reload
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.
@Kokan Thanks for the note. And I am agreed with it, this is a little bit misleading here.
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.
Thanks, I modified the code according to this pattern.
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.
@norberttak Thanks for the PR and the changes.
In my last review I have found only one minor thing, but it can be resolved in another PR also
With this regexp based parsing, the detection of received trap objects is more robust. Furthermore it allows us to enable debug logs in the snmptrapd output Signed-off-by: Norbert Takacs <norbert.takacs@oneidentity.com>
Signed-off-by: Norbert Takacs <norbert.takacs@oneidentity.com>
Signed-off-by: Andras Mitzki <andras.mitzki@balabit.com>
Signed-off-by: Andras Mitzki <andras.mitzki@balabit.com>
Signed-off-by: Norbert Takacs <norbert.takacs@oneidentity.com>
Add the stats query function to destination driver Signed-off-by: Norbert Takacs <norbert.takacs@oneidentity.com>
8e858ff
Signed-off-by: Norbert Takacs <norbert.takacs@oneidentity.com>
Signed-off-by: Norbert Takacs <norbert.takacs@oneidentity.com>
Build SUCCESS |
This PR contains the snmpv2 test cases writen in Light test frame work. The snmpv3 tests will be in a separated PR