mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2026-02-02 11:25:10 +01:00
feat: add support for running NixOS VM tests more easily
This commit is contained in:
parent
f8fa0846ce
commit
c64e0cce0c
4 changed files with 139 additions and 24 deletions
|
|
@ -64,6 +64,7 @@ There are currently 3 types of tests:
|
|||
- `snapshot` -> snapshot testing, only needs `actual` and compares that to the snapshot
|
||||
- `unit` -> equality checking, needs `expected` and `actual` or `actualDrv`
|
||||
- `script` -> shell script test, needs `script`
|
||||
- `vm` -> NixOS VM test, needs `vmConfig`
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
@ -126,6 +127,23 @@ Examples:
|
|||
expected = pkgs.hello;
|
||||
actual = pkgs.hello;
|
||||
}
|
||||
{
|
||||
name = "vm-test";
|
||||
type = "vm";
|
||||
# gets passed to pkgs.testers.nixosTest, so same params apply
|
||||
# name gets automatically set, so thats not required
|
||||
vmConfig = {
|
||||
nodes.machine = {
|
||||
services.nginx.enable = true;
|
||||
};
|
||||
testScript =
|
||||
# py
|
||||
''
|
||||
machine.wait_for_unit("nginx.service")
|
||||
machine.wait_for_open_port(80)
|
||||
'';
|
||||
};
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue