Skip to content

Conversation

@jfroche
Copy link
Member

@jfroche jfroche commented Jan 23, 2026

Implement a faster feedback loop for testing system-manager using containerized Ubuntu 24.04 image with system-manager.
Uses the uid-range sandbox feature to run systemd-nspawn inside Nix builds. Tests are hermetic and reproducible.

Tests run on Ubuntu 24.04 with Nix installed via nix-installer, matching how system-manager is actually deployed on non-NixOS systems. This catches issues that wouldn't surface in a VM test.

Uses the same API as NixOS VM tests (start_all(), machine.succeed(), wait_for_unit(), etc.), so developers familiar with NixOS testing can use it immediately.

For people familiar with testinfra (common in ansible, salt unit testing), we have added the testinfra library on top of the basic python test API. It adds declarative assertions (machine.service("nginx").is_running, machine.file("/etc/foo").contains("bar")) that are more readable than shell commands and provide better error messages.

--interactive mode drops into a ptpython REPL inside the running container for exploratory debugging with tab completion (require root access).

Heavily inspired by https://git.clan.lol/clan/clan-core/src/branch/main/lib/test/container-test-driver and the current NixOS tests.

Supersedes #328

@jfroche jfroche force-pushed the container-test-driver branch from 103d644 to 5ffec08 Compare January 24, 2026 12:33
Avoid hardcoding hostPlatform in example and test modules by setting
nixpkgs.hostPlatform appropriately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants