Add real runtime materialization pipeline and bundle artifacts
This commit is contained in:
parent
cbf212bb7b
commit
c43c718c83
32 changed files with 1456 additions and 27 deletions
|
|
@ -12,6 +12,8 @@ def test_resolve_runtime_paths_default_bundle() -> None:
|
|||
paths = resolve_runtime_paths()
|
||||
assert paths.firecracker_bin.exists()
|
||||
assert paths.jailer_bin.exists()
|
||||
assert paths.guest_agent_path is not None
|
||||
assert paths.guest_agent_path.exists()
|
||||
assert (paths.artifacts_dir / "debian-git" / "vmlinux").exists()
|
||||
assert paths.manifest.get("platform") == "linux-x86_64"
|
||||
|
||||
|
|
@ -45,8 +47,14 @@ def test_resolve_runtime_paths_checksum_mismatch(
|
|||
firecracker_path = copied_platform / "bin" / "firecracker"
|
||||
firecracker_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
firecracker_path.write_text("tampered\n", encoding="utf-8")
|
||||
(copied_platform / "bin" / "jailer").write_text(
|
||||
(source.jailer_bin).read_text(encoding="utf-8"),
|
||||
(copied_platform / "bin" / "jailer").write_bytes(source.jailer_bin.read_bytes())
|
||||
guest_agent_path = source.guest_agent_path
|
||||
if guest_agent_path is None:
|
||||
raise AssertionError("expected guest agent in runtime bundle")
|
||||
copied_guest_dir = copied_platform / "guest"
|
||||
copied_guest_dir.mkdir(parents=True, exist_ok=True)
|
||||
(copied_guest_dir / "pyro_guest_agent.py").write_text(
|
||||
guest_agent_path.read_text(encoding="utf-8"),
|
||||
encoding="utf-8",
|
||||
)
|
||||
for profile in ("debian-base", "debian-git", "debian-build"):
|
||||
|
|
@ -54,9 +62,7 @@ def test_resolve_runtime_paths_checksum_mismatch(
|
|||
profile_dir.mkdir(parents=True, exist_ok=True)
|
||||
for filename in ("vmlinux", "rootfs.ext4"):
|
||||
source_file = source.artifacts_dir / profile / filename
|
||||
(profile_dir / filename).write_text(
|
||||
source_file.read_text(encoding="utf-8"), encoding="utf-8"
|
||||
)
|
||||
(profile_dir / filename).write_bytes(source_file.read_bytes())
|
||||
|
||||
monkeypatch.setenv("PYRO_RUNTIME_BUNDLE_DIR", str(copied_bundle))
|
||||
with pytest.raises(RuntimeError, match="checksum mismatch"):
|
||||
|
|
@ -72,6 +78,8 @@ def test_doctor_report_has_runtime_fields() -> None:
|
|||
runtime = report.get("runtime")
|
||||
assert isinstance(runtime, dict)
|
||||
assert "firecracker_bin" in runtime
|
||||
assert "guest_agent_path" in runtime
|
||||
assert "component_versions" in runtime
|
||||
networking = report["networking"]
|
||||
assert isinstance(networking, dict)
|
||||
assert "tun_available" in networking
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue