fix(deploy): track installed device manager release generation
This commit is contained in:
@@ -278,6 +278,82 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
|
||||
def test_installed_manager_compose_follows_release_generation(self):
|
||||
with tempfile.TemporaryDirectory(
|
||||
prefix="nodedc-device-manager-compose-generation-",
|
||||
) as directory:
|
||||
root = Path(directory)
|
||||
deployment = root / "deployment"
|
||||
deployment.mkdir()
|
||||
compose = root / RUNNER.DEVICE_PLANE_MANAGER_COMPOSE_REL
|
||||
compose.write_text("services: {}\n", encoding="utf-8")
|
||||
v1 = root / RUNNER.DEVICE_PLANE_MANAGER_CONTROL_PLANE_REL
|
||||
v2 = root / RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V2_REL
|
||||
v1.write_text(
|
||||
json.dumps(device_manager_release_v1_descriptor()),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with (
|
||||
mock.patch.object(RUNNER, "DEVICE_PLANE_ROOT", root),
|
||||
mock.patch.dict(
|
||||
RUNNER.COMPONENTS["device-plane"],
|
||||
{"compose_files": ()},
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"sha256_file",
|
||||
return_value=(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V1_COMPOSE_SHA256
|
||||
),
|
||||
),
|
||||
):
|
||||
self.assertEqual(
|
||||
RUNNER.component_compose_files("device-plane"),
|
||||
(compose,),
|
||||
)
|
||||
|
||||
v2.write_text(
|
||||
json.dumps(device_manager_release_descriptor()),
|
||||
encoding="utf-8",
|
||||
)
|
||||
with (
|
||||
mock.patch.object(RUNNER, "DEVICE_PLANE_ROOT", root),
|
||||
mock.patch.dict(
|
||||
RUNNER.COMPONENTS["device-plane"],
|
||||
{"compose_files": ()},
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"sha256_file",
|
||||
return_value=(
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V2_COMPOSE_SHA256
|
||||
),
|
||||
),
|
||||
):
|
||||
self.assertEqual(
|
||||
RUNNER.component_compose_files("device-plane"),
|
||||
(compose,),
|
||||
)
|
||||
|
||||
with (
|
||||
mock.patch.object(RUNNER, "DEVICE_PLANE_ROOT", root),
|
||||
mock.patch.dict(
|
||||
RUNNER.COMPONENTS["device-plane"],
|
||||
{"compose_files": ()},
|
||||
),
|
||||
mock.patch.object(
|
||||
RUNNER,
|
||||
"sha256_file",
|
||||
return_value="0" * 64,
|
||||
),
|
||||
):
|
||||
with self.assertRaisesRegex(
|
||||
RUNNER.DeployError,
|
||||
"installed Device Manager Compose drift detected",
|
||||
):
|
||||
RUNNER.component_compose_files("device-plane")
|
||||
|
||||
def test_public_route_artifact_is_last_and_proxy_only(self):
|
||||
manifest, entries, _names, result = self.assert_deterministic_artifact(
|
||||
"build-platform-device-manager-route-artifact.mjs",
|
||||
|
||||
Reference in New Issue
Block a user