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

37 lines
1 KiB
Markdown

# 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](/tests/integration) directory.
## Run integration tests
```console
nix-build -A tests.integration.all
```
To run the "simple" integration test for keycloak, execute:
```console
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](https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests)
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:
```console
nix-build -A tests.integration.keycloak.simple.driverInteractive
./result/bin/nixos-test-driver
```