FIX - NAS DEPLOY: wait for Foundry runtime health

This commit is contained in:
Codex
2026-08-09 09:44:27 +03:00
parent 4b24c2e457
commit b511e92cf9
4 changed files with 112 additions and 35 deletions
@@ -44,6 +44,45 @@ def runtime(container_char="a", image_char="b"):
class ModuleFoundryRuntimeRecoveryTest(unittest.TestCase):
def test_healthchecks_wait_for_compose_health_before_http(self):
events = []
with (
mock.patch.object(
RUNNER,
"healthcheck_compose_service",
side_effect=lambda component, service: events.append(
("compose", component, service)
),
),
mock.patch.object(
RUNNER,
"component_healthchecks",
return_value=("http://foundry/healthz",),
),
mock.patch.object(
RUNNER,
"healthcheck_url",
side_effect=lambda check: events.append(("http", check)),
),
):
RUNNER.run_healthchecks(
"module-foundry",
("package.json",),
(RUNNER.MODULE_FOUNDRY_SERVICE,),
)
self.assertEqual(
events,
[
(
"compose",
"module-foundry",
RUNNER.MODULE_FOUNDRY_SERVICE,
),
("http", "http://foundry/healthz"),
],
)
def test_build_retries_before_any_runtime_recreate(self):
first_failure = subprocess.CalledProcessError(17, ["docker", "compose"])
completed = subprocess.CompletedProcess([], 0)
@@ -290,6 +329,7 @@ class ModuleFoundryRuntimeRecoveryTest(unittest.TestCase):
failed_entries = (
"apps/catalog/src/MapFixturePreview.tsx",
"scripts/map-sector-grid.test.mjs",
"server/map-grid-persistence.test.mjs",
)
candidate_files = {
"apps/catalog/src/MapFixturePreview.tsx": "sector-current\n",
@@ -326,6 +366,7 @@ class ModuleFoundryRuntimeRecoveryTest(unittest.TestCase):
"files.txt",
"manifest.env",
"missing-files.txt",
"module-foundry-runtime-before.json",
"source-before.tgz",
}
for name in backup_names:
@@ -377,7 +418,7 @@ class ModuleFoundryRuntimeRecoveryTest(unittest.TestCase):
"component": "module-foundry",
"id": failed_patch_id,
"message": failed_message,
"rollback_status": "not-required",
"rollback_status": "failed:DeployError",
"sha256": failed_sha256,
"started_apply": True,
"status": "failed",
@@ -416,18 +457,24 @@ class ModuleFoundryRuntimeRecoveryTest(unittest.TestCase):
"MODULE_FOUNDRY_MAP_RECOVERY_MISSING_PREDECESSOR_ENTRIES": (
missing_entries
),
"MODULE_FOUNDRY_MAP_FAILED_INSTALLED_ENTRIES": (
failed_entries[:-1]
),
"MODULE_FOUNDRY_MAP_RECOVERY_INSTALLED_TREE_SHA256": (
installed_tree
),
"MODULE_FOUNDRY_MAP_RECOVERY_CANDIDATE_TREE_SHA256": (
candidate_tree
),
"MODULE_FOUNDRY_SECTOR_FAILED_ENTRIES": failed_entries,
"MODULE_FOUNDRY_MAP_FAILED_ENTRIES": failed_entries,
"MODULE_FOUNDRY_MAP_FAILED_PATCH_ID": failed_patch_id,
"MODULE_FOUNDRY_MAP_FAILED_ARTIFACT": failed_artifact_name,
"MODULE_FOUNDRY_MAP_FAILED_ARTIFACT_SHA256": failed_sha256,
"MODULE_FOUNDRY_MAP_FAILED_BACKUP_ID": failed_backup_id,
"MODULE_FOUNDRY_MAP_FAILED_MESSAGE": failed_message,
"MODULE_FOUNDRY_MAP_FAILED_ROLLBACK_STATUS": (
"failed:DeployError"
),
"MODULE_FOUNDRY_MAP_FAILED_BACKUP_SHA256": backup_hashes,
}
with ExitStack() as stack: