-
Notifications
You must be signed in to change notification settings - Fork 32
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
Create daemon handler fixture for integration test #1826
Conversation
Additional infoIn the case of creating a variable with the necessary daemons for the API to work, the list is as follows:
If any of those daemons are not ready, the error below will be returned for any API request: {
"title": "Bad Request",
"detail": "Some Wazuh daemons are not ready yet in node \"master-node\" (wazuh-modulesd->stopped, wazuh-analysisd->stopped, wazuh-execd->stopped, wazuh-remoted->stopped)",
"dapi_errors": {
"master-node": {
"error": "Some Wazuh daemons are not ready yet in node \"master-node\" (wazuh-modulesd->stopped, wazuh-analysisd->stopped, wazuh-execd->stopped, wazuh-remoted->stopped)"
}
},
"error": 1017
} Regards. |
Raise exception in case empty daemons list
Create option for daemon_handler to use wazuh_control
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.
Good job. Some changes are requested.
Note: I have observed that you put some debug logs. This fixture will be called in every test for each use case, so these debug logs can be very noisy. Take this into account.
Respecting to this comment, yes, that could be an issue, but IMHO it is important to begin to include some verbose in our testing procedure. Maybe it would be necessary to create a new logs levels and implement tools to handle the |
Rename api daemons Fix minnor docstring error in daemon_handler fixture Improve daemons list valid value Co-authored-by: Jonathan <jonathan.martin@wazuh.com>
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.
LGTM
We can test these changes before the merge in temporal branch: |
tests/integration/conftest.py
Outdated
""" | ||
daemons = [] | ||
ignore_errors = False | ||
wazuh_control = False |
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.
Can you change this for all_daemons
or something similar. wazuh_control
is a bit confusing
Description
This PR closes #1825. It adds a common Wazuh daemon handler fixture for all integration tests, according to the repository standard
Usage
In order to use this fixture, the test should define the following dictionary at the beginning of the module:
In case of the required of restart all wazuh, it is possible to use wazuh_control using the following configuration
Where:
daemons
(list): List of daemons to use. If empty, all wazuh will be used.wazuh_control
(boolean): Enable restart of all wazuh services using wazuh_control.ignore_errors
(boolean): Enable ignore errors in daemon handling process.Tests
pycodestyle --max-line-length=120 --show-source --show-pep8 file.py
.