Begin Firecracker microVM support

This commit is contained in:
Joakim Hellsén 2026-04-25 06:34:37 +02:00
commit ed8ad1bee9
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
11 changed files with 290 additions and 7 deletions

View file

@ -0,0 +1,35 @@
from __future__ import annotations
from io import StringIO
from unittest.mock import patch
from django.core.management import call_command
from django.test import override_settings
@override_settings(DEBUG=True, TESTING=False)
def test_dev_command_check_is_reported_by_check_command() -> None:
"""System check must be visible through call_command without direct check import."""
def fake_which(command: str) -> str | None:
if command == "curl":
return None
return f"/usr/bin/{command}"
stderr = StringIO()
with patch("shutil.which", side_effect=fake_which):
call_command("check", "-t", "compatibility", stderr=stderr)
output = stderr.getvalue()
assert "(tussilago.W001) Missing host commands used by get_rootfs.bash." in output
assert "Dev-only tooling missing: curl." in output
@override_settings(DEBUG=False, TESTING=False)
def test_dev_command_check_is_not_reported_in_production_runtime() -> None:
"""Production runtime must not report dev-only tooling warning."""
stderr = StringIO()
with patch("shutil.which", return_value=None):
call_command("check", "-t", "compatibility", stderr=stderr)
assert "(tussilago.W001)" not in stderr.getvalue()