From 6fad7d14e18592a9e1545b23cd73bfd8d36f97fe Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 17 Apr 2025 16:23:34 +0200 Subject: [PATCH] Avoid using host system socket for logs tests (#5825) Make sure we mock the systemd journal gateway socket for tests. This makes the test work on systems which have systemd-journal-gatewayd installed. --- tests/api/test_host.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api/test_host.py b/tests/api/test_host.py index fee3517af..824a7150a 100644 --- a/tests/api/test_host.py +++ b/tests/api/test_host.py @@ -355,11 +355,11 @@ async def test_advanced_logs_formatters( journal_logs_reader.assert_called_once_with(ANY, LogFormatter.VERBOSE) -async def test_advanced_logs_errors(api_client: TestClient): +async def test_advanced_logs_errors(coresys: CoreSys, api_client: TestClient): """Test advanced logging API errors.""" - # coresys = coresys_logs_control with patch("supervisor.host.logs.SYSTEMD_JOURNAL_GATEWAYD_SOCKET") as socket: socket.is_socket.return_value = False + await coresys.host.logs.post_init() resp = await api_client.get("/host/logs") assert resp.content_type == "text/plain" assert resp.status == 400