2023-03-07 09:21:20 +01:00
|
|
|
# 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.
|
2023-03-07 09:36:15 +01:00
|
|
|
|
|
|
|
## Run integration tests
|
|
|
|
|
|
|
|
```console
|
2023-03-18 05:07:37 +01:00
|
|
|
nix-build -A tests.integration.all
|
2023-03-07 09:36:15 +01:00
|
|
|
```
|
2023-03-10 09:02:33 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
```
|