aboutsummaryrefslogtreecommitdiffstats
path: root/tests/by-name/dn
diff options
context:
space:
mode:
Diffstat (limited to 'tests/by-name/dn')
-rw-r--r--tests/by-name/dn/dns/test.nix66
1 files changed, 34 insertions, 32 deletions
diff --git a/tests/by-name/dn/dns/test.nix b/tests/by-name/dn/dns/test.nix
index 01d8833..cf1d67b 100644
--- a/tests/by-name/dn/dns/test.nix
+++ b/tests/by-name/dn/dns/test.nix
@@ -1,14 +1,11 @@
# Inspired by this file: /nixpkgs/nixos/tests/nsd.nix
{
- nixos-lib,
- pkgsUnstable,
- nixpkgs-unstable,
- vhackPackages,
- pkgs,
- extraModules,
- nixLib,
+ packageSets,
+ vhack,
...
}: let
+ pkgs = packageSets.stable;
+
common = {...}: {
networking.firewall.enable = false;
networking.dhcpcd.enable = false;
@@ -18,26 +15,30 @@
lib,
nodes,
...
- }: {
+ }: let
+ name =
+ if version == "ipv4"
+ then "primaryIPAddress"
+ else if version == "ipv6"
+ then "primaryIPv6Address"
+ else builtins.throw "Not a valid ip version: ${version}";
+ in {
environment.systemPackages = [pkgs.dig pkgs.dig.dnsutils];
imports = [common];
networking.nameservers = lib.mkForce [
- (lib.head nodes.server.networking.interfaces.eth1."${version}".addresses).address
+ nodes.server.networking.${name}
];
};
in
- nixos-lib.runTest {
- hostPkgs = pkgs; # the Nixpkgs package set used outside the VMs
-
+ vhack.runTest {
name = "dns";
- node = {
- specialArgs = {inherit pkgsUnstable vhackPackages nixpkgs-unstable nixLib;};
-
- # Use the nixpkgs as constructed by the `nixpkgs.*` options
- pkgs = null;
- };
+ # Problem: The `runTest` function wants to setup TLS certificates for everything and
+ # sets up it's own dns server for that. That unfortunately conflicts with our test
+ # here. But we are implicitly testing dns anyhow with the other tests, so this test
+ # is not really necessary.
+ ignore = true;
nodes = {
server = {
@@ -45,19 +46,16 @@ in
lib,
...
}: {
- imports =
- extraModules
- ++ [
- ../../../../modules
- common
- ];
+ imports = [
+ common
+ ];
vhack = {
dns = {
enable = true;
interfaces = [
- (lib.head config.networking.interfaces.eth1.ipv4.addresses).address
- (lib.head config.networking.interfaces.eth1.ipv6.addresses).address
+ config.networking.primaryIPAddress
+ config.networking.primaryIPv6Address
];
zones = {
"example.com" = {
@@ -96,17 +94,21 @@ in
clientV6 = mkClient "ipv6";
};
+ services = [
+ {clientV4 = "network.target";}
+ {clientV6 = "network.target";}
+ {server = "nsd.service";}
+ ];
+
+ ports = [
+ {server = 53;}
+ ];
+
testScript = {nodes, ...}:
/*
python
*/
''
- start_all()
-
- clientV4.wait_for_unit("network.target")
- clientV6.wait_for_unit("network.target")
- server.wait_for_unit("nsd.service")
-
def assert_host(ipVersion, dnsRecordType, dnsQuery, expected):
self = clientV4 if ipVersion == 4 else clientV6
out = self.succeed(f"host -{ipVersion} -t {dnsRecordType} {dnsQuery}").rstrip()