aboutsummaryrefslogtreecommitdiffstats
path: root/tests/by-name/ro/rocie
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-18 22:35:46 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-18 22:35:46 +0200
commitb84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007 (patch)
tree42b64963341fc7e6251e16c68dfbdb4b3be54aa1 /tests/by-name/ro/rocie
parentscripts/update_hosts.sh: Use faster `nix copy` and ping hosts after update (diff)
downloadnixos-server-b84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007.zip
tests: Refactor to unify tests and avoid duplicated code
Diffstat (limited to 'tests/by-name/ro/rocie')
-rw-r--r--tests/by-name/ro/rocie/test.nix89
1 files changed, 15 insertions, 74 deletions
diff --git a/tests/by-name/ro/rocie/test.nix b/tests/by-name/ro/rocie/test.nix
index c2ba97a..1f0fccb 100644
--- a/tests/by-name/ro/rocie/test.nix
+++ b/tests/by-name/ro/rocie/test.nix
@@ -1,66 +1,21 @@
{
- nixos-lib,
- pkgsUnstable,
- nixpkgs-unstable,
- vhackPackages,
- pkgs,
extraModules,
- nixLib,
+ vhack,
...
}:
-nixos-lib.runTest {
- hostPkgs = pkgs; # the Nixpkgs package set used outside the VMs
-
+vhack.runTest {
name = "rocie";
- node = {
- specialArgs = {inherit pkgsUnstable extraModules vhackPackages nixpkgs-unstable nixLib;};
-
- # Use the nixpkgs as constructed by the `nixpkgs.*` options
- pkgs = null;
- };
+ serverDomains = [
+ {server = "rocie.server";}
+ ];
nodes = {
- acme = {...}: {
- imports = [
- ../../../common/acme/server.nix
- ../../../common/dns/client.nix
- ];
- };
- name_server = {nodes, ...}: {
- imports =
- extraModules
- ++ [
- ../../../common/acme/client.nix
- ../../../common/dns/server.nix
- ];
-
- vhack.dns.zones = {
- "rocie.server" = {
- SOA = {
- nameServer = "ns";
- adminEmail = "admin@server.com";
- serial = 2025012301;
- };
- useOrigin = false;
-
- A = [
- nodes.server.networking.primaryIPAddress
- ];
- AAAA = [
- nodes.server.networking.primaryIPv6Address
- ];
- };
- };
- };
-
server = {config, ...}: {
imports =
extraModules
++ [
../../../../modules
- ../../../common/acme/client.nix
- ../../../common/dns/client.nix
];
age.identityPaths = ["${../../../common/email/hostKey}"];
@@ -76,31 +31,17 @@ nixos-lib.runTest {
};
};
- client = {...}: {
- imports = [
- ../../../common/acme/client.nix
- ../../../common/dns/client.nix
- ];
- };
+ client = {_, ...}: {};
};
- testScript = {nodes, ...}: let
- acme = import ../../../common/acme {inherit pkgs;};
- in
- acme.prepare ["server" "client"]
- # Python
- ''
- server.wait_for_unit("rocie.service")
-
- with subtest("All services running"):
- import json
- def all_services_running(host):
- (status, output) = host.systemctl("list-units --state=failed --plain --no-pager --output=json")
- host_failed = json.loads(output)
- assert len(host_failed) == 0, f"Expected zero failing services, but found: {json.dumps(host_failed, indent=4)}"
- all_services_running(server)
+ services = [
+ {server = "rocie.service";}
+ ];
- client.wait_until_succeeds("curl --verbose https://rocie.server/api/can-be-provisioned > out.file")
- client.copy_from_vm("out.file")
- '';
+ testScript = {...}:
+ # Python
+ ''
+ client.wait_until_succeeds("curl --verbose https://rocie.server/api/can-be-provisioned > out.file")
+ client.copy_from_vm("out.file")
+ '';
}