1
0
Fork 0
selfhostblocks/docs/tutorials/integrationtests.md
2023-03-17 21:09:44 -07:00

1 KiB

Integration Tests

Integration tests configure real virtual machines and run tests on those to assert some properties.

You can find all integration tests under the tests/integration directory.

Run integration tests

nix-build -A tests.integration.all

To run the "simple" integration test for keycloak, execute:

nix-build -A tests.integration.keycloak.simple

Write integration tests

To create an integration test for disnix, you'll need:

  • a tarball,
  • a manifest build,
  • and a test definition with a test script written in Python.

The NixOS official documentation has a complete reference on what python functions are available in the test script.

To iterate on the test script, the easiest is by far to use the interactive mode by using the .driverInteractive attribute, like so:

nix-build -A tests.integration.keycloak.simple.driverInteractive
./result/bin/nixos-test-driver