Skip to content

The agent that grows with you

test(agent): drain the log queue before reading errors.log in the config-load warning test

Teknium125d95d59d73
diff --git a/tests/agent/test_config_load_warning.py b/tests/agent/test_config_load_warning.py
index b7be449a3e8..f6efa9a3f5e 100644
--- a/tests/agent/test_config_load_warning.py
+++ b/tests/agent/test_config_load_warning.py
@@ -6,6 +6,8 @@ from unittest.mock import patch
import pytest
+import hermes_logging
+
@pytest.fixture
def make_agent(monkeypatch):
@@ -134,6 +136,8 @@ def test_config_failure_warns_without_exposing_values_and_preserves_defaults(
"sections": "memory",
}
messages = [record.getMessage() for record in warnings]
+ # errors.log is written by the logging QueueListener thread: drain it before reading the file.
+ hermes_logging.flush_log_queue()
persisted = (home / "logs" / "errors.log").read_text(encoding="utf-8-sig")
for scope in affected:
assert any(expected_sections[scope] in message for message in messages)