Addon startup waits for healthy (#4376)

* Addon startup waits for healthy

* fix import for pylint

* wait_for to 5 in tests

* Adjust tests to simplify async tasks

* Remove wait_boot time from addons.boot tests

* Eliminate async task race conditions in tests
This commit is contained in:
Mike Degatano
2023-06-20 10:13:15 -04:00
committed by GitHub
parent e4ee3e4226
commit 254ec2d1af
23 changed files with 846 additions and 65 deletions

View File

@@ -377,6 +377,7 @@ async def tmp_supervisor_data(coresys: CoreSys, tmp_path: Path) -> Path:
coresys.config.path_audio.mkdir()
coresys.config.path_dns.mkdir()
coresys.config.path_share.mkdir()
coresys.config.path_addons_data.mkdir(parents=True)
yield tmp_path
@@ -641,3 +642,15 @@ async def mount_propagation(docker: DockerAPI, coresys: CoreSys) -> None:
}
await coresys.supervisor.load()
yield
@pytest.fixture
async def container(docker: DockerAPI) -> MagicMock:
"""Mock attrs and status for container on attach."""
docker.containers.get.return_value = addon = MagicMock()
docker.containers.create.return_value = addon
docker.images.pull.return_value = addon
docker.images.build.return_value = (addon, "")
addon.status = "stopped"
addon.attrs = {"State": {"ExitCode": 0}}
yield addon