deploy: keep manager health out of plan
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import importlib.machinery
|
||||
import importlib.util
|
||||
import inspect
|
||||
import json
|
||||
import tempfile
|
||||
import unittest
|
||||
@@ -27,6 +28,75 @@ RUNNER = load_runner()
|
||||
|
||||
|
||||
class DevicePlaneRegistryTest(unittest.TestCase):
|
||||
def test_manager_predecessor_health_is_phase_scoped(self):
|
||||
with self.assertRaisesRegex(
|
||||
RUNNER.DeployError,
|
||||
"preflight phase is invalid",
|
||||
):
|
||||
RUNNER.validate_device_plane_manager_activation_predecessor(
|
||||
Path("/not-used"),
|
||||
preflight_phase="unknown",
|
||||
)
|
||||
|
||||
plan_source = inspect.getsource(RUNNER.plan_artifact)
|
||||
self.assertIn('preflight_phase="plan"', plan_source)
|
||||
apply_source = inspect.getsource(RUNNER.apply_artifact)
|
||||
self.assertIn('preflight_phase="apply"', apply_source)
|
||||
|
||||
def test_manager_v3_health_gate_checks_only_preserved_services(self):
|
||||
descriptor = {
|
||||
"schemaVersion": (
|
||||
"nodedc.device-plane.device-manager-release.v3"
|
||||
),
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service",
|
||||
) as healthcheck:
|
||||
services = (
|
||||
RUNNER.validate_device_plane_manager_preserved_runtime_health(
|
||||
descriptor
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
services,
|
||||
("device-control-core", "device-postgres"),
|
||||
)
|
||||
self.assertEqual(
|
||||
healthcheck.call_args_list,
|
||||
[
|
||||
mock.call("device-plane", "device-control-core"),
|
||||
mock.call("device-plane", "device-postgres"),
|
||||
],
|
||||
)
|
||||
self.assertNotIn(
|
||||
mock.call("device-plane", "device-manager"),
|
||||
healthcheck.call_args_list,
|
||||
)
|
||||
|
||||
def test_legacy_manager_health_gate_excludes_selected_services(self):
|
||||
descriptor = {
|
||||
"schemaVersion": (
|
||||
"nodedc.device-plane.device-manager-release.v2"
|
||||
),
|
||||
}
|
||||
with mock.patch.object(
|
||||
RUNNER,
|
||||
"healthcheck_compose_service",
|
||||
) as healthcheck:
|
||||
services = (
|
||||
RUNNER.validate_device_plane_manager_preserved_runtime_health(
|
||||
descriptor
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(services, ("device-postgres",))
|
||||
healthcheck.assert_called_once_with(
|
||||
"device-plane",
|
||||
"device-postgres",
|
||||
)
|
||||
|
||||
def test_registry_has_exact_roots_project_and_stateless_services(self):
|
||||
component = RUNNER.COMPONENTS["device-plane"]
|
||||
root = Path("/volume1/docker/nodedc-device-plane")
|
||||
|
||||
Reference in New Issue
Block a user