feat(lab): install thin adapter layers offline

This commit is contained in:
DCCONSTRUCTIONS
2026-08-31 19:51:51 +03:00
parent 8eced6c34d
commit b2ae29b8d8
2 changed files with 303 additions and 0 deletions
@@ -0,0 +1,50 @@
from __future__ import annotations
from pathlib import Path
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
INSTALLER = (
REPOSITORY_ROOT
/ "experiments/perception/worker/observatory_portable"
/ "Install-LabV1ComponentAdapterImages.ps1"
)
def test_component_image_installer_is_exact_local_and_offline() -> None:
script = INSTALLER.read_text(encoding="utf-8")
assert '"docker-commit-exact-layer-v1"' in script
assert "--network none" in script
assert "--cap-drop ALL" in script
assert "--security-opt no-new-privileges" in script
assert "target=/nodedc-build-source,readonly" in script
assert "Get-FileSha256" in script
assert "Invoke-InstalledImageSmoke" in script
assert "docker commit @changes $containerId $tag" in script
assert "docker rm -f $containerId" in script
assert "com.nodedc.build-method" in script
lowered = script.lower()
assert "docker pull" not in lowered
assert "invoke-webrequest" not in lowered
assert "start-bitstransfer" not in lowered
assert "curl " not in lowered
assert "wget " not in lowered
assert "smb" not in lowered
def test_component_image_installer_binds_bases_and_adapter_sources() -> None:
script = INSTALLER.read_text(encoding="utf-8")
for digest in (
"58df7489c3f2276f9591d500a012dee03e23d35543ce3c390b4c001e6bf90794",
"591cb382c099eeb05e7ec16e2371e0b2da54d2bb5c49ec0f4ac88dbf72b0f0cd",
"fb208c6cd337153827147006cd26bf4c1c00963f91eb801280485dbc7213d08b",
"b48ef255403abcfd177a6550688410a52b0fbd29d2a54c8417cb5a0daa330ad5",
"d2af887b065b0f63890768d59247114e49b70ad490c027f20eefd98682636c3c",
):
assert digest in script
assert 'entrypoint = \'["python3"]\'' in script
assert '"goose","python"' in script
assert 'command = \'["/opt/nodedc/adapter/run_portable_lab_v1_eomt_component.py"]\'' in script
assert 'command = \'["/opt/nodedc/adapter/run_portable_lab_v1_ddrnet_component.py"]\'' in script