Reduce executor code for docker (#4438)

* Reduce executor code for docker

* Fix pylint errors and move import/export image

* Fix test and a couple other risky executor calls

* Fix dataclass and return

* Fix test case and add one for corrupt docker

* Add some coverage

* Undo changes to docker manager startup
This commit is contained in:
Mike Degatano
2023-07-18 11:39:39 -04:00
committed by GitHub
parent 1f940a04fd
commit 1f92ab42ca
34 changed files with 969 additions and 847 deletions

View File

@@ -1,4 +1,5 @@
"""Test Docker interface."""
import asyncio
from typing import Any
from unittest.mock import MagicMock, Mock, PropertyMock, call, patch
@@ -151,6 +152,7 @@ async def test_attach_existing_container(
"supervisor.docker.interface.time", return_value=1
):
await coresys.homeassistant.core.instance.attach(AwesomeVersion("2022.7.3"))
await asyncio.sleep(0)
fire_event.assert_called_once_with(
BusEvent.DOCKER_CONTAINER_STATE_CHANGE,
DockerContainerStateEvent("homeassistant", expected, "abc123", 1),
@@ -160,6 +162,7 @@ async def test_attach_existing_container(
await coresys.homeassistant.core.instance.attach(
AwesomeVersion("2022.7.3"), skip_state_event_if_down=True
)
await asyncio.sleep(0)
if fired_when_skip_down:
fire_event.assert_called_once_with(
BusEvent.DOCKER_CONTAINER_STATE_CHANGE,