mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-10-12 13:19:29 +00:00
Compare commits
5 Commits
fix-websoc
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c21a8b8ef | ||
![]() |
ddb8588d77 | ||
![]() |
81e46b20b8 | ||
![]() |
5041a1ed5c | ||
![]() |
337731a55a |
1
.github/workflows/stale.yml
vendored
1
.github/workflows/stale.yml
vendored
@@ -16,6 +16,7 @@ jobs:
|
||||
days-before-close: 7
|
||||
stale-issue-label: "stale"
|
||||
exempt-issue-labels: "no-stale,Help%20wanted,help-wanted,pinned,rfc,security"
|
||||
only-issue-types: "bug"
|
||||
stale-issue-message: >
|
||||
There hasn't been any activity on this issue recently. Due to the
|
||||
high number of incoming GitHub notifications, we have to clean some
|
||||
|
@@ -19,11 +19,11 @@ jinja2==3.1.6
|
||||
log-rate-limit==1.4.2
|
||||
orjson==3.11.3
|
||||
pulsectl==24.12.0
|
||||
pyudev==0.24.3
|
||||
pyudev==0.24.4
|
||||
PyYAML==6.0.3
|
||||
requests==2.32.5
|
||||
securetar==2025.2.1
|
||||
sentry-sdk==2.40.0
|
||||
sentry-sdk==2.41.0
|
||||
setuptools==80.9.0
|
||||
voluptuous==0.15.2
|
||||
dbus-fast==2.44.5
|
||||
|
@@ -10,7 +10,7 @@ pytest-timeout==2.4.0
|
||||
pytest==8.4.2
|
||||
ruff==0.14.0
|
||||
time-machine==2.19.0
|
||||
types-docker==7.1.0.20250916
|
||||
types-docker==7.1.0.20251009
|
||||
types-pyyaml==6.0.12.20250915
|
||||
types-requests==2.32.4.20250913
|
||||
urllib3==2.5.0
|
||||
|
@@ -222,11 +222,6 @@ class APIProxy(CoreSysAttributes):
|
||||
raise HTTPBadGateway()
|
||||
_LOGGER.info("Home Assistant WebSocket API request initialize")
|
||||
|
||||
# Check if transport is still valid before WebSocket upgrade
|
||||
if request.transport is None:
|
||||
_LOGGER.warning("WebSocket connection lost before upgrade")
|
||||
raise web.HTTPBadRequest(reason="Connection closed")
|
||||
|
||||
# init server
|
||||
server = web.WebSocketResponse(heartbeat=30)
|
||||
await server.prepare(request)
|
||||
|
@@ -8,7 +8,7 @@ from ..const import UnsupportedReason
|
||||
from .base import EvaluateBase
|
||||
|
||||
EXPECTED_LOGGING = "journald"
|
||||
EXPECTED_STORAGE = "overlay2"
|
||||
EXPECTED_STORAGE = ("overlay2", "overlayfs")
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -41,14 +41,18 @@ class EvaluateDockerConfiguration(EvaluateBase):
|
||||
storage_driver = self.sys_docker.info.storage
|
||||
logging_driver = self.sys_docker.info.logging
|
||||
|
||||
if storage_driver != EXPECTED_STORAGE:
|
||||
is_unsupported = False
|
||||
|
||||
if storage_driver not in EXPECTED_STORAGE:
|
||||
is_unsupported = True
|
||||
_LOGGER.warning(
|
||||
"Docker storage driver %s is not supported!", storage_driver
|
||||
)
|
||||
|
||||
if logging_driver != EXPECTED_LOGGING:
|
||||
is_unsupported = True
|
||||
_LOGGER.warning(
|
||||
"Docker logging driver %s is not supported!", logging_driver
|
||||
)
|
||||
|
||||
return storage_driver != EXPECTED_STORAGE or logging_driver != EXPECTED_LOGGING
|
||||
return is_unsupported
|
||||
|
@@ -9,7 +9,7 @@ import logging
|
||||
from typing import Any, cast
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from aiohttp import ClientWebSocketResponse, WSCloseCode, web
|
||||
from aiohttp import ClientWebSocketResponse, WSCloseCode
|
||||
from aiohttp.http_websocket import WSMessage, WSMsgType
|
||||
from aiohttp.test_utils import TestClient
|
||||
import pytest
|
||||
@@ -223,32 +223,6 @@ async def test_proxy_auth_abort_log(
|
||||
)
|
||||
|
||||
|
||||
async def test_websocket_transport_none(
|
||||
coresys,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
):
|
||||
"""Test WebSocket connection with transport None is handled gracefully."""
|
||||
# Get the API proxy instance from coresys
|
||||
api_proxy = APIProxy.__new__(APIProxy)
|
||||
api_proxy.coresys = coresys
|
||||
|
||||
# Create a mock request with transport set to None to simulate connection loss
|
||||
mock_request = AsyncMock(spec=web.Request)
|
||||
mock_request.transport = None
|
||||
|
||||
caplog.clear()
|
||||
with caplog.at_level(logging.WARNING):
|
||||
# This should raise HTTPBadRequest, not AssertionError
|
||||
with pytest.raises(web.HTTPBadRequest) as exc_info:
|
||||
await api_proxy.websocket(mock_request)
|
||||
|
||||
# Verify the error reason
|
||||
assert exc_info.value.reason == "Connection closed"
|
||||
|
||||
# Verify the warning was logged
|
||||
assert "WebSocket connection lost before upgrade" in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", ["", "mock_path"])
|
||||
async def test_api_proxy_get_request(
|
||||
api_client: TestClient,
|
||||
|
@@ -25,13 +25,18 @@ async def test_evaluation(coresys: CoreSys):
|
||||
assert docker_configuration.reason in coresys.resolution.unsupported
|
||||
coresys.resolution.unsupported.clear()
|
||||
|
||||
coresys.docker.info.storage = EXPECTED_STORAGE
|
||||
coresys.docker.info.storage = EXPECTED_STORAGE[0]
|
||||
coresys.docker.info.logging = "unsupported"
|
||||
await docker_configuration()
|
||||
assert docker_configuration.reason in coresys.resolution.unsupported
|
||||
coresys.resolution.unsupported.clear()
|
||||
|
||||
coresys.docker.info.storage = EXPECTED_STORAGE
|
||||
coresys.docker.info.storage = "overlay2"
|
||||
coresys.docker.info.logging = EXPECTED_LOGGING
|
||||
await docker_configuration()
|
||||
assert docker_configuration.reason not in coresys.resolution.unsupported
|
||||
|
||||
coresys.docker.info.storage = "overlayfs"
|
||||
coresys.docker.info.logging = EXPECTED_LOGGING
|
||||
await docker_configuration()
|
||||
assert docker_configuration.reason not in coresys.resolution.unsupported
|
||||
|
Reference in New Issue
Block a user