-
Notifications
You must be signed in to change notification settings - Fork 90
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
tests: add a test for missing runmode v2 #1442
Conversation
Ticket: #5711
|
||
## Issue Description | ||
|
||
The issue relates to Suricata not providing adequate feedback when the runmode is missing, leading to confusion for users. |
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.
nit: please add redmine ticket link here
The issue relates to Suricata not providing adequate feedback when the runmode is missing, leading to confusion for users. | ||
|
||
|
||
|
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.
nit: unneeded whitespace
|
||
|
||
|
||
|
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.
nit: unneeded whitespace
|
||
|
||
|
||
|
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.
nit: unneeded whitespace
|
||
exit-code: 1 | ||
args: | ||
- --dump-config |
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.
This is not needed for the test, it was an example given by Juliana. The args should be just like mentioned in the redmine ticket.
checks: | ||
- shell: | ||
args: suricata -S /dev/null | ||
expect: 1 |
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.
I don't understand this test. Could you please explain what were you trying to do here?
Note: This test does not seem to be testing what you've done in your Suricata PR, you should be looking for the error message in the Suricata logs/stderr. e.g. tests/detect-bsize-01/test.yaml
Hint: Recommended steps to follow:
- Try to understand what
shell
checks are doing looking at other tests. - Check out the
output
dir created in your test after you run it. See what's inside each file. - Get back to fixing the test.
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.
I don't understand this test. Could you please explain what were you trying to do here? Note: This test does not seem to be testing what you've done in your Suricata PR, you should be looking for the error message in the Suricata logs/stderr. e.g.
tests/detect-bsize-01/test.yaml
Hint: Recommended steps to follow:
- Try to understand what
shell
checks are doing looking at other tests.- Check out the
output
dir created in your test after you run it. See what's inside each file.- Get back to fixing the test.
Okay, I actually included this test to check whether Suricata behaves correctly when a specific run mode is missing. To do that, I ran Suricata with the '-S /dev/null' argument, which simulates the absence of the 'capture' run mode. I expected Suricata to return an error code (1) in this scenario, indicating that the run mode is missing.
But if I understand, I am expected to check for the presence of the expected error message in Suricata logs.
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 for going through your thought process :)
So, as I mentioned on the previous review, you don't have to invoke shell to run suricata in Suricata-verify tests. So, whatever arguments you want to pass for this test to run suricata with, those would passed in that args
section where you've putt the --dump-config
option, instead.
For the expected exit code, and how to check for an error message from the output - in case you don't want to check log outputs, you can check this test: https://github.com/OISF/suricata-verify/blob/master/tests/detect-strip_whitespace-01/test.yaml#L5C1-L5C1
Not that right above the first args
section, there's an exit-code: 1
line. That is how you tell suricata-verify that you expect Suri to exit with error code 1.
I hope this helps you move forward with this contribution! :)
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.
Okay, thanks. It helps
Ticket: 5711
Test for missing suricata capture runmode hint
Incoporated previous feedback on running test
Previous PR: #1434
Suricata PR: OISF/suricata#9692
Redmine ticket: https://redmine.openinfosecfoundation.org/issues/5711