Skip to content
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

DTT2 - Testing Module. Enhance the test assertions #5297

Open
mhamra opened this issue Apr 25, 2024 · 0 comments
Open

DTT2 - Testing Module. Enhance the test assertions #5297

mhamra opened this issue Apr 25, 2024 · 0 comments

Comments

@mhamra
Copy link
Member

mhamra commented Apr 25, 2024

Target version Related issue Related PR/dev branch
4.9.0 #5229 PR #5264 4495-dtt1-release

Description

The assertions of the Module's tests call the logger.error method instead of returning an error message. This method returns None. The current implementation generates all the AssertionError exception messages as None. For example, this code:

assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), logger.error(f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}')

We should implement it in this way:

assert HostInformation.dir_exists(wazuh_params['master'], WAZUH_ROOT), f'The {WAZUH_ROOT} is not present in {HostInformation.get_os_name_and_version_from_inventory(wazuh_params["master"])}' 

The other important point is whether the assertion should send the errors to the log file because Pytest sends the AssertionError exception to the final report.

Related PR comment: comment

@rauldpm rauldpm changed the title DTT1. Testing Module. Enhance the test assertions DTT2 - Testing Module. Enhance the test assertions Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants