diff options
| author | tv <tv@krebsco.de> | 2026-11-11 21:25:03 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-11 21:25:03 +0000 |
| commit | a018f44c9132ffa5c7b987369010868d0bc95c74 (patch) | |
| tree | 62f59ff4cb8c3b44978eb6485153ecb25b742876 /README.md | |
| parent | 1dc0ba39d8103e072d8cc8676f0ac19dbe3f8e1b (diff) | |
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.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 `<nixpkgs>` 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/) |
