diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-18 22:35:46 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-07-18 22:35:46 +0200 |
| commit | b84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007 (patch) | |
| tree | 42b64963341fc7e6251e16c68dfbdb4b3be54aa1 /tests/by-name/ta | |
| parent | scripts/update_hosts.sh: Use faster `nix copy` and ping hosts after update (diff) | |
| download | nixos-server-b84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007.zip | |
tests: Refactor to unify tests and avoid duplicated code
Diffstat (limited to 'tests/by-name/ta')
| -rw-r--r-- | tests/by-name/ta/taskchampion-sync/test.nix | 66 |
1 files changed, 9 insertions, 57 deletions
diff --git a/tests/by-name/ta/taskchampion-sync/test.nix b/tests/by-name/ta/taskchampion-sync/test.nix index 4bca4e0..3878167 100644 --- a/tests/by-name/ta/taskchampion-sync/test.nix +++ b/tests/by-name/ta/taskchampion-sync/test.nix @@ -6,64 +6,26 @@ pkgs, extraModules, nixLib, + vhack, ... }: -nixos-lib.runTest { - hostPkgs = pkgs; +vhack.runTest { name = "taskchampion-sync"; - node = { - specialArgs = {inherit pkgsUnstable vhackPackages nixpkgs-unstable nixLib;}; - - # Use the nixpkgs as constructed by the `nixpkgs.*` options - pkgs = null; - }; + serverDomains = [ + {server = "taskchampion.server";} + ]; nodes = let taskwarriorPackage = pkgs.taskwarrior3.overrideAttrs (final: prev: { cmakeFlags = (prev.cmakeFlags or []) ++ ["-DENABLE_TLS_NATIVE_ROOTS=true"]; }); in { - 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 = { - "taskchampion.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 ]; vhack = { @@ -77,27 +39,21 @@ nixos-lib.runTest { }; task_client1 = {config, ...}: { - imports = [ - ../../../common/acme/client.nix - ../../../common/dns/client.nix - ]; - environment.systemPackages = [ taskwarriorPackage ]; }; task_client2 = {config, ...}: { - imports = [ - ../../../common/acme/client.nix - ../../../common/dns/client.nix - ]; - environment.systemPackages = [ taskwarriorPackage ]; }; }; + services = [ + {server = "taskchampion-sync-server.service";} + ]; + testScript = {nodes, ...}: let # Generated with uuidgen uuid = "bf01376e-04a4-435a-9263-608567531af3"; @@ -112,13 +68,9 @@ nixos-lib.runTest { echo 'sync.server.client_id=${uuid}' >> "${path}" echo 'sync.encryption_secret=${password}' >> "${path}" ''; - - acme = import ../../../common/acme {inherit pkgs;}; in - acme.prepare ["server" "task_client1" "task_client2"] # Python '' - server.wait_for_unit("taskchampion-sync-server.service") server.wait_for_open_port(443) with subtest("Setup task syncing"): |
