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

Add new system test for GET /cluster/ruleset/synchronization endpoint #3180

Merged
merged 4 commits into from
Aug 24, 2022

Conversation

Selutario
Copy link
Contributor

@Selutario Selutario commented Aug 17, 2022

Related issue
Closes #3170

Description

It is necessary to know when the cluster has synchronized any changes in the custom ruleset. To do this, an endpoint has been added that calculates the synchronization status on demand:

GET /cluster/ruleset/synchronization

This system test verifies that the synchronization status is False after a change to the ruleset and it remains this way until the integrity synchronization occurs in each node.

Added

  • clear_file_without_recreate(...): It truncates a file (leaves it empty) without recreating it. If the file is recreated, it forces the process that was using it (in this case, wazuh-clusterd) to restart so that it opens a file descriptor to the new log file. But restarting the cluster forces a sync in a point where it should be avoided.
  • find_file(...): This tool has already been added in other developments, but all of them were done for version newer than 4.3.
  • conftest - update_cluster_json(): A new fixture has been added inside the test_cluster conftest of the system folder.
  • test_ruleset_sync_status.py: The test itself.

Testing performed

Tester Test path Jenkins Local OS Commit Notes
@Selutario (Developer) tests/system/test_cluster/test_ruleset_sync_status- /test_ruleset_sync_status.py 🚫 🚫 🚫 🟢🟢🟢 Ubuntu 20.04 63a2987 Nothing to highlight
@juliamagan (Reviewer) tests/system/test_cluster/test_ruleset_sync_status/ 🚫 🚫 🚫 🟢 🟢 🟢 Debian Buster e59301b Nothing to highlight

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

@jmv74211 jmv74211 merged commit 4aac3a0 into 4.3 Aug 24, 2022
@jmv74211 jmv74211 deleted the feature/3170-cluster-sync-status-system-test branch August 24, 2022 10:20
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.

Tests development - System test for Cluster ruleset sync status endpoint
4 participants