1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2026-04-17 23:54:06 +01:00

Wait for Core to install and start in Supervisor tests (#4544)

Backup now fails after home-assistant/supervisor#6553 if Core isn't installed
and started. Similarly to the tests in the Supervisor CI, wait until Core
install finishes before proceeding with other tests in the suite.
This commit is contained in:
Jan Čermák
2026-02-17 16:10:03 +01:00
committed by GitHub
parent d149b5a730
commit 7d0b0231bc

View File

@@ -16,7 +16,7 @@ def stash() -> dict:
@pytest.mark.dependency()
@pytest.mark.timeout(120)
@pytest.mark.timeout(360)
def test_start_supervisor(shell, shell_json):
def check_container_running(container_name):
out = shell.run_check(f"docker container inspect -f '{{{{.State.Status}}}}' {container_name} || true")
@@ -42,6 +42,34 @@ def test_start_supervisor(shell, shell_json):
sleep(1)
logger.info("Waiting for Home Assistant Core to be installed and started...")
core_install_started = False
while True:
try:
jobs_info = shell_json("ha jobs info --no-progress --raw-json")
if jobs_info.get("result") != "ok":
sleep(5)
continue
jobs = jobs_info.get("data", {}).get("jobs", [])
core_installing = any(
j.get("name") == "home_assistant_core_install" and not j.get("done")
for j in jobs
)
if core_installing:
# install is in progress
if not core_install_started:
logger.info("Home Assistant Core install job detected, waiting for completion...")
core_install_started = True
elif core_install_started:
# started and not installing anymore means finished
logger.info("Home Assistant Core install/start complete")
break
except ExecutionError:
pass # avoid failure when the supervisor/CLI is restarting
sleep(5)
@pytest.mark.dependency(depends=["test_start_supervisor"])
def test_check_supervisor(shell_json):
# check supervisor info