diff --git a/deployability/modules/testing/tests/test_agent/test_install.py b/deployability/modules/testing/tests/test_agent/test_install.py index 46b8ca486f..00be163104 100644 --- a/deployability/modules/testing/tests/test_agent/test_install.py +++ b/deployability/modules/testing/tests/test_agent/test_install.py @@ -3,7 +3,6 @@ from ..helpers.manager import WazuhManager from ..helpers.agent import WazuhAgent from ..helpers.generic import HostConfiguration, CheckFiles, HostInformation, GeneralComponentActions -from ..helpers.executor import WazuhAPI from ..helpers.constants import WAZUH_ROOT diff --git a/deployability/modules/testing/tests/test_agent/test_registration.py b/deployability/modules/testing/tests/test_agent/test_registration.py index efddb1b67a..7ecb312934 100644 --- a/deployability/modules/testing/tests/test_agent/test_registration.py +++ b/deployability/modules/testing/tests/test_agent/test_registration.py @@ -1,10 +1,8 @@ import pytest -import time from ..helpers.manager import WazuhManager, WazuhAPI from ..helpers.agent import WazuhAgent, WazuhAPI -from ..helpers.generic import HostConfiguration, CheckFiles, HostInformation, GeneralComponentActions -from ..helpers.constants import WAZUH_ROOT +from ..helpers.generic import GeneralComponentActions from ..helpers.utils import dynamic_wait @pytest.fixture @@ -67,6 +65,7 @@ def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): assert GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent') + expected_condition_func = lambda: 'active' == WazuhAgent.get_agent_status(wazuh_api, agent_names) dynamic_wait(expected_condition_func, cycles=10, waiting_time=20) diff --git a/deployability/modules/testing/tests/test_agent/test_restart.py b/deployability/modules/testing/tests/test_agent/test_restart.py index f049950ff1..1d0d22989c 100644 --- a/deployability/modules/testing/tests/test_agent/test_restart.py +++ b/deployability/modules/testing/tests/test_agent/test_restart.py @@ -1,9 +1,7 @@ import pytest from ..helpers.manager import WazuhManager -from ..helpers.agent import WazuhAgent -from ..helpers.generic import HostConfiguration, CheckFiles, HostInformation, GeneralComponentActions -from ..helpers.constants import WAZUH_ROOT +from ..helpers.generic import GeneralComponentActions @pytest.fixture diff --git a/deployability/modules/testing/tests/test_agent/test_stop.py b/deployability/modules/testing/tests/test_agent/test_stop.py index e0a8ef5c52..f661afdd7c 100644 --- a/deployability/modules/testing/tests/test_agent/test_stop.py +++ b/deployability/modules/testing/tests/test_agent/test_stop.py @@ -1,10 +1,8 @@ import pytest -from ..helpers.manager import WazuhManager, WazuhAPI -from ..helpers.agent import WazuhAgent -from ..helpers.generic import HostConfiguration, CheckFiles, HostInformation, GeneralComponentActions -from ..helpers.constants import WAZUH_ROOT - +from ..helpers.agent import WazuhAgent, WazuhAPI +from ..helpers.generic import GeneralComponentActions +from ..helpers.utils import dynamic_wait @pytest.fixture def wazuh_params(request): @@ -56,5 +54,7 @@ def test_stop(wazuh_params): for agent_names, agent_params in wazuh_params['agents'].items(): assert 'inactive' in GeneralComponentActions.get_component_status(agent_params, 'wazuh-agent') - assert 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) assert not GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent') + + expected_condition_func = lambda: 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) + dynamic_wait(expected_condition_func, cycles=10, waiting_time=20) \ No newline at end of file diff --git a/deployability/modules/testing/tests/test_agent/test_uninstall.py b/deployability/modules/testing/tests/test_agent/test_uninstall.py index b0e9d40693..1fbd89f5ad 100644 --- a/deployability/modules/testing/tests/test_agent/test_uninstall.py +++ b/deployability/modules/testing/tests/test_agent/test_uninstall.py @@ -2,7 +2,8 @@ from ..helpers.manager import WazuhManager, WazuhAPI from ..helpers.agent import WazuhAgent -from ..helpers.generic import HostConfiguration, CheckFiles, HostInformation, GeneralComponentActions +from ..helpers.generic import CheckFiles, HostInformation, GeneralComponentActions +from ..helpers.utils import dynamic_wait from ..helpers.constants import WAZUH_ROOT @@ -97,4 +98,6 @@ def test_isActive(wazuh_params): wazuh_api = WazuhAPI(wazuh_params['master']) for agent_names, agent_params in wazuh_params['agents'].items(): assert not GeneralComponentActions.isComponentActive(agent_params, 'wazuh-agent') - assert 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) + + expected_condition_func = lambda: 'disconnected' == WazuhAgent.get_agent_status(wazuh_api, agent_names) + dynamic_wait(expected_condition_func, cycles=10, waiting_time=20) \ No newline at end of file