From b84c9c7382dc05d1ff5f3bdaf2bac7ce3c332007 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 18 Jul 2026 22:35:46 +0200 Subject: tests: Refactor to unify tests and avoid duplicated code --- tests/by-name/at/atuin-sync/test.nix | 69 ++++++------------------------------ 1 file changed, 11 insertions(+), 58 deletions(-) (limited to 'tests/by-name/at') diff --git a/tests/by-name/at/atuin-sync/test.nix b/tests/by-name/at/atuin-sync/test.nix index 0f2cd24..627e89e 100644 --- a/tests/by-name/at/atuin-sync/test.nix +++ b/tests/by-name/at/atuin-sync/test.nix @@ -7,63 +7,26 @@ extraModules, nixLib, turtle, + vhack, ... }: -nixos-lib.runTest { - hostPkgs = pkgs; +vhack.runTest { name = "atuin-sync"; - - node = { - specialArgs = {inherit pkgsUnstable vhackPackages nixpkgs-unstable nixLib;}; - - # Use the nixpkgs as constructed by the `nixpkgs.*` options - pkgs = null; - }; + serverDomains = [ + { + server = "atuin-sync.server"; + } + ]; nodes = let atuinSession = "01969ec6b8d07e30a9d2df0911fbfe2a"; atuin = turtle.packages."${pkgs.stdenv.hostPlatform.system}".default; 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 = { - "atuin-sync.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,11 +40,6 @@ nixos-lib.runTest { }; client1 = {config, ...}: { - imports = [ - ../../../common/acme/client.nix - ../../../common/dns/client.nix - ]; - environment.sessionVariables.ATUIN_SESSION = atuinSession; environment.systemPackages = [ @@ -90,11 +48,6 @@ nixos-lib.runTest { ]; }; client2 = {config, ...}: { - imports = [ - ../../../common/acme/client.nix - ../../../common/dns/client.nix - ]; - environment.sessionVariables.ATUIN_SESSION = atuinSession; environment.systemPackages = [ @@ -104,6 +57,10 @@ nixos-lib.runTest { }; }; + services = [ + {server = "turtle.service";} + ]; + testScript = {nodes, ...}: let mkSyncConfig = pkgs.writeShellScript "register-atuin-sync-account" '' mkdir --parents ~/.config/atuin/ @@ -136,13 +93,9 @@ nixos-lib.runTest { run_and_record_in_atuin "$@" ''; - - acme = import ../../../common/acme {inherit pkgs;}; in - acme.prepare ["server" "client1" "client2"] # Python '' - server.wait_for_unit("turtle.service") server.wait_for_open_port(443) # Wait for the server to acquire the acme certificate -- cgit v1.3.1