Add new system test for GET /cluster/ruleset/synchronization
endpoint
#3180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.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
tests/system/test_cluster/test_ruleset_sync_status
-/test_ruleset_sync_status.py
tests/system/test_cluster/test_ruleset_sync_status/