diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-02 00:31:34 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-02 00:31:34 +0200 |
| commit | a5d2eced839fb8501f5c62e7045cf0f2536c051f (patch) | |
| tree | 90ac85a9966208859bc5fb6dc556f4d974d76a65 /tests | |
| parent | tests/default: Document the `runTest` arguments (diff) | |
| download | nixos-server-a5d2eced839fb8501f5c62e7045cf0f2536c051f.zip | |
tests/default: Allow adding stuff to the default dns config
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/default.nix | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/default.nix b/tests/default.nix index b9c3cbd..b679dc1 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -19,6 +19,18 @@ name, # Node definition, like in a normal nixos vm test. nodes ? {}, + # Extra DNS configuration with the node's config as input. + # Example: + # ``` + # server1 = {config, ...}: { + # "domain.example.org" = { + # TXT = [ "test" ]; + # }; + # }; + # ``` + # That will add the TXT record to the `domain.example.org` domain, the `config` will + # be from the `server1` node. + dns ? {}, # Server domains that all clients and the server can resolve via dns. # The format follows the common one, e.g.: # `{nodeName = "domain.example.com";}` @@ -37,7 +49,7 @@ # Apparently the default's (e.g. `serivces ? []`), are not applied for the `@args` # syntax. args = { - inherit name nodes serverDomains testScript services ignore; + inherit name dns nodes serverDomains testScript services ignore; }; in specialArgs.nixos-lib.runTest { @@ -102,6 +114,15 @@ builtins.listToAttrs (builtins.map mkDomain args.serverDomains); }; } + + (pkgs.lib.mapAttrs' (nodeName: dnsOverride: { + name = "name_server"; + value = {nodes, ...}: { + vhack.dns.zones = dnsOverride {config = nodes."${nodeName}";}; + }; + }) + args.dns) + args.nodes (builtins.mapAttrs (_: _: { imports = [ |
