From a018f44c9132ffa5c7b987369010868d0bc95c74 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 11 Nov 2026 21:25:03 +0000 Subject: tests: add NixOS VM tests for populate tests/default.nix provides one VM test per source type, and one for features spanning sources. Each test runs scenarios from tests/scenarios.nix, which cover every combination of a source type's options, deployed to the deploying machine itself, to a remote target as root, and to a remote target using sudo. A scenario prepares the target directory, deploys, checks the result, and deploys and checks again. Scenarios expecting populate to fail check its error message, or check at evaluation time if populate is expected not to evaluate. The deploying machine creates fixtures using tests/fixtures.sh and serves them via HTTP and git daemon, so flakes can be fetched on the target without further network access. Checks evaluate delivered flakes without network access to the fixtures after collecting garbage, so they verify that the delivered store paths are complete and rooted. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index fe28fca..79ace5b 100644 --- a/README.md +++ b/README.md @@ -516,6 +516,22 @@ flakes, as long as the inputs drawing from them are declared with `flake = false`. +## Tests + +`tests/` contains NixOS VM tests for populate: one test per source type, and +one for features spanning sources, such as flake inputs from sources. Each +test deploys every combination of a source type's options to the deploying +machine itself, to a remote target as `root`, and to a remote target using +`sudo`, and checks the result after deploying and after deploying again. +The tests require KVM and nixpkgs with `pkgs.testers.runNixOSTest` +(23.05 or later), and use `` by default. + +```sh +nix-build tests # all tests +nix-build tests -A flake # the test for one source type +``` + + ## References - [In-depth example](http://tech.ingolf-wagner.de/nixos/krops/) by [Ingolf Wagner](https://ingolf-wagner.de/) -- cgit v1.3.1