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.
This commit is contained in:
Stefan Agner 2025-04-17 16:23:34 +02:00 committed by GitHub
parent f7317134e3
commit 6fad7d14e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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