fix(device-plane): split edge channel bootstrap
This commit is contained in:
@@ -185,7 +185,7 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
|
||||
manifest, entries, names, result = self.assert_deterministic_artifact(
|
||||
"build-device-manager-control-plane-artifact.mjs",
|
||||
"device-manager-control-plane-unit-001",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V2_ENTRIES,
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V1_SUCCESSOR_ENTRIES,
|
||||
)
|
||||
self.assertEqual(manifest["component"], "device-plane")
|
||||
self.assertEqual(
|
||||
@@ -242,19 +242,53 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
|
||||
compose = (
|
||||
PLATFORM_ROOT / "device-plane/docker-compose.device-manager.yml"
|
||||
).read_text(encoding="utf-8")
|
||||
for required in (
|
||||
'DEVICE_EDGE_CHANNEL_ENABLED: "true"',
|
||||
"DEVICE_EDGE_CHANNEL_CORE_KEY_FILE: ",
|
||||
"DEVICE_EDGE_CHANNEL_CORE_CERTIFICATE_FILE: ",
|
||||
"DEVICE_EDGE_CHANNEL_TRUST_ROOT: ",
|
||||
for forbidden in (
|
||||
"DEVICE_EDGE_CHANNEL_",
|
||||
"device-edge-channel/",
|
||||
"name: nodedc-device-plane-egress",
|
||||
):
|
||||
self.assertIn(required, compose)
|
||||
self.assertNotIn(forbidden, compose)
|
||||
self.assertNotIn("PRIVATE KEY", compose)
|
||||
checks = RUNNER.component_healthchecks("device-plane", entries, tuple(result["services"]))
|
||||
self.assertEqual(checks[0]["expected_json"]["managementApi"], "enabled")
|
||||
self.assertEqual(checks[0]["expected_json"]["discoveryIngest"], "enabled")
|
||||
|
||||
def test_edge_core_channel_bootstrap_is_core_only_and_secret_free(self):
|
||||
manifest, entries, names, result = self.assert_deterministic_artifact(
|
||||
"build-device-edge-core-channel-bootstrap-artifact.mjs",
|
||||
"device-edge-core-channel-bootstrap-unit-001",
|
||||
RUNNER.DEVICE_PLANE_EDGE_CORE_CHANNEL_BOOTSTRAP_ENTRIES,
|
||||
)
|
||||
self.assertEqual(manifest["component"], "device-plane")
|
||||
self.assertEqual(
|
||||
RUNNER.component_services("device-plane", entries),
|
||||
("device-control-core",),
|
||||
)
|
||||
builds = RUNNER.component_builds("device-plane", entries)
|
||||
self.assertEqual(len(builds), 1)
|
||||
self.assertIn(RUNNER.DEVICE_PLANE_CONTROL_CORE_IMAGE, builds[0][1])
|
||||
self.assertEqual(result["services"], ["device-control-core"])
|
||||
self.assertFalse(any(
|
||||
name.startswith("payload/services/device-manager/")
|
||||
or name.startswith("payload/services/device-gateway/")
|
||||
for name in names
|
||||
))
|
||||
self.assertIn(
|
||||
"payload/packages/device-edge-channel-contract/src/index.mjs",
|
||||
names,
|
||||
)
|
||||
self.assertIn(
|
||||
"payload/docker-compose.device-edge-core-channel.yml",
|
||||
names,
|
||||
)
|
||||
checks = RUNNER.component_healthchecks(
|
||||
"device-plane",
|
||||
entries,
|
||||
tuple(result["services"]),
|
||||
)
|
||||
self.assertEqual(checks[0]["expected_json"]["managementApi"], "enabled")
|
||||
self.assertEqual(checks[0]["expected_json"]["commandTransport"], "disabled")
|
||||
|
||||
def test_release_v2_keeps_release_v1_predecessor_contract_immutable(self):
|
||||
predecessor = device_manager_release_v1_descriptor(
|
||||
release_id="device-manager-release-20260811-010",
|
||||
@@ -417,7 +451,7 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
|
||||
):
|
||||
RUNNER.prepare_component_runtime(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V2_ENTRIES,
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V1_SUCCESSOR_ENTRIES,
|
||||
)
|
||||
self.assertEqual(
|
||||
[call.args[0] for call in ensure.call_args_list],
|
||||
@@ -429,10 +463,37 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
|
||||
RUNNER.PLATFORM_DEVICE_CORE_INTERNAL_TOKEN_FILE,
|
||||
],
|
||||
)
|
||||
ensure_edge_identity.assert_called_once_with()
|
||||
ensure_edge_identity.assert_not_called()
|
||||
|
||||
with (
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"ensure_platform_runtime_secret",
|
||||
) as ensure,
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"ensure_device_edge_channel_core_identity",
|
||||
) as ensure_edge_identity,
|
||||
):
|
||||
RUNNER.prepare_component_runtime(
|
||||
"device-plane",
|
||||
RUNNER.DEVICE_PLANE_EDGE_CORE_CHANNEL_BOOTSTRAP_ENTRIES,
|
||||
)
|
||||
self.assertEqual(
|
||||
[call.args[0] for call in ensure.call_args_list],
|
||||
[
|
||||
RUNNER.DEVICE_PLANE_POSTGRES_PASSWORD_FILE,
|
||||
RUNNER.DEVICE_PLANE_GATEWAY_CORE_TOKEN_FILE,
|
||||
RUNNER.DEVICE_PLANE_IDENTIFIER_PEPPER_FILE,
|
||||
RUNNER.DEVICE_PLANE_MANAGEMENT_CORE_TOKEN_FILE,
|
||||
],
|
||||
)
|
||||
ensure_edge_identity.assert_called_once_with(
|
||||
allow_invalid_unexported_recovery=True
|
||||
)
|
||||
|
||||
def test_apply_gate_checks_exact_services_core_contract_and_runtime_boundary(self):
|
||||
entries = RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V2_ENTRIES
|
||||
entries = RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V1_SUCCESSOR_ENTRIES
|
||||
services = ("device-control-core", "device-manager")
|
||||
with (
|
||||
mock.patch.object(
|
||||
|
||||
Reference in New Issue
Block a user