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

Fix timeout and performance issues in Indexer E2E requests #5003

Merged
merged 14 commits into from
Feb 23, 2024

Conversation

Rebits
Copy link
Member

@Rebits Rebits commented Feb 21, 2024

Description

This PR include several fixes for the E2E Vulnerability Detection tests:

  • Increased the timeout for each agent to scan initial vulnerabilities
  • Fix error in imports introduced in previous PR review
  • Changes the logic for indexer request in order to improve efficiency.

Testing performed

E2E Initial scans: InitialScans.zip

Warning

No assets were included due to they surpass the maximun size. We should consider allow customization of the report assets to reduce the size

Report failures are due to:

  • test_syscollector_first_scan_alerts: No vulns are detected for windows hosts. Reported here Vulnerability Detection encounters issues while processing PyPI packages wazuh#21811
  • test_syscollector_first_scan_index: It seems that indexer connection was lost in the middle of the test. Further research is required. It has been checked manually that wazuh-indexer is running and the keystore was correctly updated. After restarting indexer seems to work as expected.
  • tests_syscollector_vulnerabilities_index_alerts_consistency: Same as test_syscollector_first_scan_index

@Rebits Rebits self-assigned this Feb 21, 2024
@Rebits Rebits linked an issue Feb 21, 2024 that may be closed by this pull request
@Rebits Rebits marked this pull request as ready for review February 21, 2024 18:14
Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ! Only a few minor changes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file there are changes from #4959, so it will be locked until the previous PR is merged.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this change depends on the #4959. However, it does not block the development.

@@ -139,6 +133,12 @@ def setup_vulnerability_tests(host_manager: HostManager) -> Generator:
logger.error("Restarting managers")
host_manager.control_environment('restart', ['manager'])

logger.error("Save the Wazuh indexer username and password into the Wazuh manager keystore")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be info or debug instead of error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not determinate the logic of the logging. I suggest the following:

  • Critical: Logging messages from the tests
  • Error: Logging messages from the fixtures
  • Info: Logging messages from the rest of the libraries
  • Debug: Very verbose logging messages like testinfra/ansible debug messages

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will revisit this in the future

logging_message = 'Syscollector scan not started in the following agents:' \
f"{test_result['evidences']['agents_not_scanned_first_scan']}."
logger.critical(logging_message)
pytest.fail(logging_message)
else:
logger.critical("All agents has been scanned")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related conversation #5003 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will revisit this in the future

juliamagan
juliamagan previously approved these changes Feb 22, 2024
Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davidjiglesias davidjiglesias merged commit 735ec8b into 4.8.0 Feb 23, 2024
1 of 3 checks passed
@davidjiglesias davidjiglesias deleted the fix/4938-timeout-increase branch February 23, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase timestamp in Vulnerability Detection E2E initial scans
3 participants