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

Agents are not being restarted after manager change in E2E vulnerability detection tests #5345

Closed
Rebits opened this issue May 7, 2024 · 8 comments · Fixed by #5355
Closed
Assignees
Labels

Comments

@Rebits
Copy link
Member

Rebits commented May 7, 2024

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.

@santipadilla
Copy link
Member

santipadilla commented May 8, 2024

Investigating the truncation process, we can see that:

  1. 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.

  2. 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.

  3. 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.

@santipadilla
Copy link
Member

santipadilla commented May 9, 2024

Test before changes

  • Truncating logs for the test_change_agent_manager case

report.zip

Test after changes

  • Without truncating logs for the test_change_agent_manager case

report.zip

@santipadilla
Copy link
Member

santipadilla commented May 9, 2024

Changes made in this branch: fix/5345-skip-truncate-test-change-agent-manager
In this PR: #5355

@rafabailon
Copy link
Member

LGTM

@santipadilla
Copy link
Member

Moved ETA due to final review

@Rebits
Copy link
Member Author

Rebits commented May 13, 2024

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 (wazuh/wazuh#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.

@Rebits Rebits changed the title Change manager Vulnerability Detector E2E test case logs are truncated Agents are not being restarted after manager change in E2E vulnerability detection tests May 13, 2024
@santipadilla
Copy link
Member

santipadilla commented May 13, 2024

Update

Test before modifying permutate_agents_managers fixture

report.zip

Test after modifying permutate_agents_managers fixture

report.zip

Test with only test_change_agent_manager case

report.zip

@santipadilla
Copy link
Member

New changes made in this branch: fix/5345-skip-truncate-test-change-agent-manager
In this PR: #5355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
4 participants