build(packaging): retain qualified payloads through verified owner archives
This commit is contained in:
@@ -345,7 +345,7 @@ def producer_hooks(module, store, monkeypatch):
|
||||
monkeypatch.setattr(module, "input_hold", hold)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("kind", ["native", "package", "owner", "node"])
|
||||
@pytest.mark.parametrize("kind", ["native", "package", "owner", "node", "node-archived"])
|
||||
def test_actual_producers_publish_valid_archives_and_active_holds(store, monkeypatch, capsys, kind):
|
||||
# Exercise the real producer wrappers with tiny synthetic inputs. No SDK execution,
|
||||
# compiler, board, network or production build is involved.
|
||||
@@ -397,10 +397,12 @@ def test_actual_producers_publish_valid_archives_and_active_holds(store, monkeyp
|
||||
write("plugins/insta360-x4/build/native/" + name)
|
||||
for name in (
|
||||
"scripts/packaging/debian.py",
|
||||
"tests/test_media_reconfiguration.py",
|
||||
"apps/node-agent/packaging/insta360_profile.py",
|
||||
"apps/node-agent/packaging/install_owner_release.py",
|
||||
"apps/node-agent/packaging/can_maintenance.py",
|
||||
"apps/node-agent/packaging/vesc_hall_recovery.py",
|
||||
"apps/node-agent/packaging/k1_maintenance.py",
|
||||
"src/k1link/__init__.py",
|
||||
"src/k1link/fleet/__init__.py",
|
||||
"src/k1link/fleet/sensors.py",
|
||||
@@ -410,6 +412,7 @@ def test_actual_producers_publish_valid_archives_and_active_holds(store, monkeyp
|
||||
elif kind == "owner":
|
||||
module = load_producer("plugins/insta360-x4/packaging/build_owner_builder.py", monkeypatch)
|
||||
monkeypatch.setattr(module, "ROOT", xroot)
|
||||
write('scripts/packaging/qualified_payloads.py')
|
||||
report = document(
|
||||
"qualified-report.json", {"sha256": "f" * 64, "bytes": 0, "file": "qualified.deb"}
|
||||
)
|
||||
@@ -433,12 +436,36 @@ def test_actual_producers_publish_valid_archives_and_active_holds(store, monkeyp
|
||||
)
|
||||
document("apps/node-agent/packaging/linux-toolchains.json", {"files": []})
|
||||
document("apps/node-agent/packaging/realsense-bundle.json", {"wheels": []})
|
||||
vendor = write("apps/node-agent/build/netbird/netbird-fixture.tar.gz")
|
||||
document("src/k1link/fleet/netbird/clients.lock.json", {"items": [{
|
||||
"id": "linux-amd64", "filename": vendor.name, "bytes": vendor.stat().st_size,
|
||||
"sha256": hashlib.sha256(vendor.read_bytes()).hexdigest(),
|
||||
}]})
|
||||
package = write("mission-core-insta360-x4_0.1.0_amd64.deb")
|
||||
digest = hashlib.sha256(package.read_bytes()).hexdigest()
|
||||
document(
|
||||
"apps/node-agent/packaging/insta360-profile.json",
|
||||
{"version": "0.1.0", "bytes": 7, "sha256": digest},
|
||||
)
|
||||
if kind == 'node-archived':
|
||||
from qualified_payloads import QualifiedPayloads
|
||||
qualification = store.root / 'x4-qualified'
|
||||
qualification.mkdir()
|
||||
package = qualification / package.name
|
||||
package.write_bytes(b'fixture')
|
||||
report_bytes = b'{"version":"0.1.0","revision":1}'
|
||||
(qualification / 'package-result.json').write_bytes(report_bytes)
|
||||
archive_root = xroot / 'build'
|
||||
archive_root.mkdir(parents=True, exist_ok=True)
|
||||
payloads = QualifiedPayloads(qualification, archive_root, store.root)
|
||||
monkeypatch.setattr('qualified_payloads.open_files', lambda paths: None)
|
||||
with payloads.locked():
|
||||
artifact = archive_root / ('mission-core-x4-install-' + 'b' * 24 + '.pyz')
|
||||
published = payloads.publish(artifact, {package.name: b'fixture'})
|
||||
payloads.register(published, {package.name: b'fixture'},
|
||||
'package-result.json', report_bytes)
|
||||
assert payloads.closeout()['state'] == 'complete'
|
||||
assert not package.exists()
|
||||
write("plugins/vesc/build/native-runtime/native.so")
|
||||
document(
|
||||
"plugins/vesc/packaging/native-runtime.json",
|
||||
@@ -451,7 +478,8 @@ def test_actual_producers_publish_valid_archives_and_active_holds(store, monkeyp
|
||||
monkeypatch.setattr(module, "USB_CAN_SDK_SHA256", digest)
|
||||
write("apps/node-agent/packaging/linux_build_entry.py")
|
||||
producer_hooks(module, store, monkeypatch)
|
||||
if kind == "node":
|
||||
if kind in ("node", "node-archived"):
|
||||
(xroot / 'build').mkdir(parents=True, exist_ok=True)
|
||||
result = module.build(package, node_only=True)
|
||||
elif kind == "owner":
|
||||
module.build(report)
|
||||
@@ -464,6 +492,11 @@ def test_actual_producers_publish_valid_archives_and_active_holds(store, monkeyp
|
||||
record = store._state()["inputs"][str(path.relative_to(store.root))]
|
||||
assert record["state"] == "active" and record["owner"] == owner
|
||||
assert not store.plan()["errors"] and not list(path.parent.glob(".retention-*"))
|
||||
if kind == 'node-archived':
|
||||
with zipfile.ZipFile(path) as archive:
|
||||
member = 'source/' + store.root.name + '/apps/node-agent/build/model-packages/'
|
||||
assert archive.read(member + package.name) == b'fixture'
|
||||
assert not package.exists()
|
||||
|
||||
|
||||
def test_late_legacy_adoption_does_not_make_an_old_input_newest(store):
|
||||
|
||||
Reference in New Issue
Block a user