Server integration tests - Authd flaky test
| Wazuh version | Component | Install type | Install method | Platform |
|---|---|---|---|---|
| 4.10.6 | authd | Manager | Sources | ubuntu-22.04 (GitHub-hosted runner) |
Description
The weekly 4_testintegration_authd-tier-0-1 run for branch 4.10.6 (triggered by the
integration-component-test-manager weekly automation, tracked in
wazuh/wazuh#39564 — Week 39) failed on
all 4 attempts of the same run:
https://github.com/wazuh/wazuh/actions/runs/35857591574
In 3 of the 4 attempts the only failures are setup/teardown errors in
test_authd/test_cluster/test_authd_local.py, all raising the same exception:
Exception: The wdb socket is not up. wazuh-db was restarted but the socket was not foundraised from mocking.create_mocked_agent() → global_db.create_or_update_agent() →
database.query_wdb() while inserting mocked pre-existent agents for the test. The number
and identity of affected test cases varies between attempts, which points to timing/flakiness
in wazuh-db startup rather than a deterministic bug.
Attempt 1 additionally reproduces a second, previously-reported failure (same signature as wazuh/wazuh#35632 and wazuh/wazuh#25430):
test_authd_use_password_invalid[Use empty password file.]
> with pytest.raises(ValueError):
E Failed: DID NOT RAISE <class 'ValueError'>Attempt 1 — 1 failed, 161 passed, 2 skipped, 1 xfailed, 4 errors
https://github.com/wazuh/wazuh/actions/jobs/107169711925
FAILED test_authd/test_use_password/test_authd_use_password_invalid.py::test_authd_use_password_invalid[Use empty password file.]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Add duplicate agent without force options in request]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Failed duplicate registration]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Remove agent]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Agent with key hash and group]Attempt 2 — 164 passed, 2 skipped, 1 xfailed, 1 error
https://github.com/wazuh/wazuh/actions/jobs/107227957132
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Force registration]Attempt 3 — 163 passed, 2 skipped, 1 xfailed, 3 errors
https://github.com/wazuh/wazuh/actions/jobs/107541582905
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Add duplicate agent without force options in request]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Remove agent]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Agent with key hash simple]Attempt 4 — 161 passed, 2 skipped, 1 xfailed, 7 errors
https://github.com/wazuh/wazuh/actions/jobs/107584623367
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Add duplicate agent without force options in request]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Failed duplicate registration]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Force registration]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Remove agent]
ERROR test_authd/test_cluster/test_authd_local.py::test_authd_local_messages[Agent with key hash simple]
ERROR test_authd/test_common/test_authd_key_hash.py::test_ossec_auth_messages_with_key_hash[Testing ip and hash parsing options with different key]
ERROR test_authd/test_force_options/test_authd_force_options.py::test_authd_force_options[registration_time_0]Full traceback of the representative error (identical shape in every attempt):
complete log excerpt_ ERROR at setup of test_authd_local_messages[Add duplicate agent without force options in request] _
@pytest.fixture()
def insert_pre_existent_agents(test_metadata, stop_authd):
"""
Create some agents and add them to the DB and keys file.
"""
...
> mocking.create_mocked_agent(id=id, name=name, ip=ip, date_add=registration_time,
connection_status=connection_status, disconnection_time=disconnection_time,
client_key_secret=key)
test_authd/conftest.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.10/dist-packages/wazuh_testing/utils/mocking.py:295: in create_mocked_agent
global_db.create_or_update_agent(agent_id=agent_id_str, name=name, ip=ip, register_ip=register_ip, ...)
/usr/local/lib/python3.10/dist-packages/wazuh_testing/utils/db_queries/global_db.py:53: in create_or_update_agent
database.query_wdb(query)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def query_wdb(command, response_only=True, multiple_responses=False) -> List[str]:
# If the wdb socket is not yet up, then wait or restart wazuh-db
if not os.path.exists(WAZUH_DB_SOCKET_PATH):
max_retries = 6
for _ in range(2):
retry = 0
while not os.path.exists(WAZUH_DB_SOCKET_PATH) and retry < max_retries:
time.sleep(0.5)
retry += 1
if not os.path.exists(WAZUH_DB_SOCKET_PATH):
services.control_service('restart', daemon=WAZUH_DB_DAEMON)
if not os.path.exists(WAZUH_DB_SOCKET_PATH):
> raise Exception('The wdb socket is not up. wazuh-db was restarted but the socket was not found')
E Exception: The wdb socket is not up. wazuh-db was restarted but the socket was not found
/usr/local/lib/python3.10/dist-packages/wazuh_testing/utils/database.py:51: ExceptionSource: wazuh/wazuh