wazuh-qa
wazuh-qa copied to clipboard
Change manager Vulnerability Detector E2E test case logs are truncated
Description
It has been detected in Release 4.8.0 - RC 1 - Vulnerability Detection E2E tests, that the test case test_change_agent_manager is truncating the agent/manager logs, making difficult to get any information of the environment in case of failure.
Investigating the truncation process, we can see that:
-
In conftest.py file, clean_environment_logs and clean_environment_logs_function: both functions perform similar actions but have a different scope. They manage logs by deleting them at the end of their scope using truncate_remote_host_group_files.
-
In logs.py file, truncate_remote_host_group_files: this function directly handles log deletion. It takes parameters to decide which host group and file types should be truncated.
-
In file.py file, truncate_file: this function performs the action of opening the specified file in write mode, which automatically truncates the file.
To carry out this issue a conditional will be added to the clean_environment_logs function so that when the test_change_agent_manager case is performed it avoids truncation.
Test before changes
- Truncating logs for the
test_change_agent_managercase
Test after changes
- Without truncating logs for the
test_change_agent_managercase
- Known test failures: https://github.com/wazuh/wazuh-qa/issues/5319
Changes made in this branch: fix/5345-skip-truncate-test-change-agent-manager
In this PR: https://github.com/wazuh/wazuh-qa/pull/5355
LGTM
Moved ETA due to final review
During a meeting with @santipadilla, we identified that the new agent configuration isn't properly applied after the configured agent is permuted because the agent isn't restarted following the change. It's likely that the restart agent call was inadvertently omitted during a merge or PR review.
The solution appears straightforward: ensure that agents are restarted after the permutate_manager fixture is applied.
Updated the issue title accordingly
[!WARNING] It's imperative to rerun this test in the E2E environment. Unfortunately, a current bug in RC1 (https://github.com/wazuh/wazuh/issues/23301) is hindering the appearance of some vulnerabilities. Therefore, we'll need to wait until this issue is resolved before verifying if there are any product-related issues concerning the manager change.
Update
Test before modifying permutate_agents_managers fixture
Test after modifying permutate_agents_managers fixture
Test with only test_change_agent_manager case
New changes made in this branch: fix/5345-skip-truncate-test-change-agent-manager
In this PR: https://github.com/wazuh/wazuh-qa/pull/5355