diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f30a23f3f..2907cb68dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Release report: TBD ### Changed +- Improve `test_remove_audit` FIM test to retry install and remove command ([#3562](https://github.com/wazuh/wazuh-qa/pull/3562)) \- (Tests) - Skip unstable integration tests for gcloud ([#3531](https://github.com/wazuh/wazuh-qa/pull/3531)) \- (Tests) - Skip unstable integration test for agentd ([#3538](https://github.com/wazuh/wazuh-qa/pull/3538)) - Update wazuhdb_getconfig and EPS limit integration tests ([#3146](https://github.com/wazuh/wazuh-qa/pull/3146)) \- (Tests) diff --git a/tests/integration/test_fim/test_files/test_audit/test_remove_audit.py b/tests/integration/test_fim/test_files/test_audit/test_remove_audit.py index feab2a50f8..98e869c9bb 100644 --- a/tests/integration/test_fim/test_files/test_audit/test_remove_audit.py +++ b/tests/integration/test_fim/test_files/test_audit/test_remove_audit.py @@ -69,6 +69,7 @@ from distro import id from wazuh_testing.tools.configuration import load_wazuh_configurations, check_apply_test from wazuh_testing.tools.monitoring import FileMonitor +from wazuh_testing.tools.utils import retry # Marks @@ -88,6 +89,21 @@ configurations = load_wazuh_configurations(configurations_path, __name__) +# Function + +@retry(subprocess.CalledProcessError, attempts=5, delay=10) +def run_process(command_list): + """Execute the command_list command + + Args: + command_list (list): Command to be executed. + + Returns: + subprocess.CompletedProcess: Command executed. + """ + return subprocess.run(command_list, check=True) + + # Fixtures @pytest.fixture(scope='module', params=configurations) @@ -115,13 +131,13 @@ def uninstall_install_audit(): raise ValueError(f"Linux distro ({linux_distro}) not supported for uninstall/install audit") # Uninstall audit - process = subprocess.run([package_management, "remove", audit, option], check=True) + process = run_process([package_management, "remove", audit, option]) yield # Install audit and start the service - process = subprocess.run([package_management, "install", audit, option], check=True) - process = subprocess.run(["service", "auditd", "start"], check=True) + process = run_process([package_management, "install", audit, option]) + process = run_process(["service", "auditd", "start"]) # Test