Begin Firecracker microVM support
This commit is contained in:
parent
fa6af127c1
commit
ed8ad1bee9
11 changed files with 290 additions and 7 deletions
35
tests/test_dev_command_checks_integration.py
Normal file
35
tests/test_dev_command_checks_integration.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue