ark/tests
bors[bot] f14dcdaf78
Merge #224
224: Allow for directories in module-list r=nrdxp a=Pacman99

fixes #221 
building on #222 this PR improves the lib functions pathsToImportedAttrs and pathsIn. First to add support for directories. This does not support actually passing a file in a directory, so `./matrix/default.nix` won't work but `./matrix` will - I should probably document this somewhere. 
Also I moved the filtering for nix files to `pathsIn`, since its only necessary for auto-import. We can assume that users would pass proper files in `module-list.nix`.

Co-authored-by: Pacman99 <pachum99@gmail.com>
2021-03-29 17:22:20 +00:00
..
profiles tests: init testSuites 2021-03-29 09:05:54 -07:00
testPathsToImportedAttrs lib/pathsToImportedAttrs: allow directories 2021-03-29 08:54:25 -07:00
default.nix home-manager: simple test 2021-03-26 00:31:45 -06:00
lib.nix Merge #224 2021-03-29 17:22:20 +00:00
README.md treewide cleanups and refactoring for initial tests (#157) 2021-03-14 07:10:51 +00:00

Testing

Testing is always an important aspect of any software development project, and NixOS offers some incredibly powerful tools to write tests for your configuration, and, optionally, run them in CI.

Lib Tests

You can easily write tests for your own library functions in the tests/lib.nix file and they will be run on every nix flake check or during a CI run.

Unit Tests

Unit tests are can be created from regular derivations, and they can do almost anything you can imagine. By convention, it is best to test your packages during their check phase. All packages and their tests will be built during CI.

Integration Tests

You can write integration tests for one or more NixOS VMs that can, optionally, be networked together, and yes, it's as awesome as it sounds!

Be sure to use the mkTest function, in the tests/default.nix which wraps the official testing-python function to ensure that the system is setup exactly as it is for a bare DevOS system. There are already great resources for learning how to use these tests effectively, including the official docs, a fantastic blog post, and the examples in nixpkgs.