1 import ./make-test-python.nix ({ pkgs, lib, ... }: {
2 name = "systemd-resolved";
3 meta.maintainers = [ lib.maintainers.elvishjerricco ];
5 nodes.server = { lib, config, ... }: let
6 exampleZone = pkgs.writeTextDir "example.com.zone" ''
7 @ SOA ns.example.com. noc.example.com. 2019031301 86400 7200 3600000 172800
8 @ A ${(lib.head config.networking.interfaces.eth1.ipv4.addresses).address}
9 @ AAAA ${(lib.head config.networking.interfaces.eth1.ipv6.addresses).address}
12 networking.firewall.enable = false;
13 networking.useDHCP = false;
15 networking.interfaces.eth1.ipv6.addresses = lib.mkForce [
16 { address = "fd00::1"; prefixLength = 64; }
26 template.default.storage = exampleZone;
27 zone."example.com".file = "example.com.zone";
32 nodes.client = { nodes, ... }: let
33 inherit (lib.head nodes.server.networking.interfaces.eth1.ipv4.addresses) address;
35 networking.nameservers = [ address ];
36 networking.interfaces.eth1.ipv6.addresses = lib.mkForce [
37 { address = "fd00::2"; prefixLength = 64; }
39 services.resolved.enable = true;
40 services.resolved.fallbackDns = [ ];
41 networking.useNetworkd = true;
42 networking.useDHCP = false;
43 systemd.network.networks."40-eth0".enable = false;
45 testing.initrdBackdoor = true;
47 systemd.enable = true;
48 systemd.initrdBin = [ pkgs.iputils ];
49 network.enable = true;
50 services.resolved.enable = true;
54 testScript = { nodes, ... }: let
55 address4 = (lib.head nodes.server.networking.interfaces.eth1.ipv4.addresses).address;
56 address6 = (lib.head nodes.server.networking.interfaces.eth1.ipv6.addresses).address;
59 server.wait_for_unit("multi-user.target")
62 query = client.succeed("resolvectl query example.com")
63 assert "${address4}" in query
64 assert "${address6}" in query
65 client.succeed("ping -4 -c 1 example.com")
66 client.succeed("ping -6 -c 1 example.com")
68 client.wait_for_unit("initrd.target")
72 client.wait_for_unit("multi-user.target")