mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 04:36:31 +00:00
Fix asyncio.wait in supervisor.reload (#4333)
* Fix asyncio.wait in supervisor.reload * Unwrap to prevent throttling across tests
This commit is contained in:
parent
0200c72db1
commit
c896b60410
@ -208,10 +208,13 @@ class APISupervisor(CoreSysAttributes):
|
|||||||
return asyncio.shield(
|
return asyncio.shield(
|
||||||
asyncio.wait(
|
asyncio.wait(
|
||||||
[
|
[
|
||||||
|
self.sys_create_task(coro)
|
||||||
|
for coro in [
|
||||||
self.sys_updater.reload(),
|
self.sys_updater.reload(),
|
||||||
self.sys_homeassistant.secrets.reload(),
|
self.sys_homeassistant.secrets.reload(),
|
||||||
self.sys_resolution.evaluate.evaluate_system(),
|
self.sys_resolution.evaluate.evaluate_system(),
|
||||||
]
|
]
|
||||||
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -160,3 +160,9 @@ async def test_api_supervisor_logs(api_client: TestClient, docker_logs: MagicMoc
|
|||||||
"\x1b[36m22-10-11 14:04:23 DEBUG (MainThread) [supervisor.utils.dbus] D-Bus call - org.freedesktop.DBus.Properties.call_get_all on /io/hass/os\x1b[0m",
|
"\x1b[36m22-10-11 14:04:23 DEBUG (MainThread) [supervisor.utils.dbus] D-Bus call - org.freedesktop.DBus.Properties.call_get_all on /io/hass/os\x1b[0m",
|
||||||
"\x1b[36m22-10-11 14:04:23 DEBUG (MainThread) [supervisor.utils.dbus] D-Bus call - org.freedesktop.DBus.Properties.call_get_all on /io/hass/os/AppArmor\x1b[0m",
|
"\x1b[36m22-10-11 14:04:23 DEBUG (MainThread) [supervisor.utils.dbus] D-Bus call - org.freedesktop.DBus.Properties.call_get_all on /io/hass/os/AppArmor\x1b[0m",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def test_api_supervisor_reload(api_client: TestClient):
|
||||||
|
"""Test supervisor reload."""
|
||||||
|
resp = await api_client.post("/supervisor/reload")
|
||||||
|
assert resp.status == 200
|
||||||
|
@ -5,6 +5,7 @@ from unittest.mock import patch
|
|||||||
|
|
||||||
from supervisor.coresys import CoreSys
|
from supervisor.coresys import CoreSys
|
||||||
from supervisor.docker.interface import DockerInterface
|
from supervisor.docker.interface import DockerInterface
|
||||||
|
from supervisor.homeassistant.secrets import HomeAssistantSecrets
|
||||||
|
|
||||||
|
|
||||||
async def test_load(coresys: CoreSys, tmp_supervisor_data: Path):
|
async def test_load(coresys: CoreSys, tmp_supervisor_data: Path):
|
||||||
@ -12,7 +13,12 @@ async def test_load(coresys: CoreSys, tmp_supervisor_data: Path):
|
|||||||
with open(tmp_supervisor_data / "homeassistant" / "secrets.yaml", "w") as secrets:
|
with open(tmp_supervisor_data / "homeassistant" / "secrets.yaml", "w") as secrets:
|
||||||
secrets.write("hello: world\n")
|
secrets.write("hello: world\n")
|
||||||
|
|
||||||
with patch.object(DockerInterface, "attach") as attach:
|
# Unwrap read_secrets to prevent throttling between tests
|
||||||
|
with patch.object(DockerInterface, "attach") as attach, patch.object(
|
||||||
|
HomeAssistantSecrets,
|
||||||
|
"_read_secrets",
|
||||||
|
new=HomeAssistantSecrets._read_secrets.__wrapped__,
|
||||||
|
):
|
||||||
await coresys.homeassistant.load()
|
await coresys.homeassistant.load()
|
||||||
|
|
||||||
attach.assert_called_once()
|
attach.assert_called_once()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user