dotfiles/nixos/tests/router.py
magic_rb cc362a70e4
Add NixOS tests test
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-07-25 14:50:50 +02:00

22 lines
693 B
Python

from test_driver.machine import Machine, StartCommand, NixStartScript
from test_driver.logger import TerminalLogger
from pathlib import Path
import os
def make_machine(out_dir: Path, tmp_dir: Path) -> Machine:
out_dir.mkdir(parents=True, exist_ok=True)
tmp_dir.mkdir(parents=True, exist_ok=True)
return Machine(
out_dir = out_dir.absolute(),
tmp_dir = tmp_dir.absolute(),
start_command = NixStartScript(os.getenv("ROUTER_CMD") + "/bin/run-nixos-vm"),
logger = TerminalLogger(),
name = "router",
)
router = make_machine(Path("router/out"), Path("router/tmp"))
router.start()
router.wait_for_unit("multi-user.target")
router.shutdown()