diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2022-01-19 11:55:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 11:55:12 +0100 |
commit | 42cbcca5010a856a6b1d2e0a4990bec95f5d4d37 (patch) | |
tree | 2d83dd13698dd21e7c8321d022f34add45f0f41e /nixos | |
parent | f12f99a320c2c748421970800162f462f8dba7e3 (diff) | |
parent | 9dfed5c9aafe292cdaea1147c923c106bbb6273b (diff) | |
download | nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.tar nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.tar.gz nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.tar.bz2 nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.tar.lz nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.tar.xz nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.tar.zst nixlib-42cbcca5010a856a6b1d2e0a4990bec95f5d4d37.zip |
Merge pull request #125474 from jojosch/dnsdist-1.6.0
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/dnsdist.nix | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index bbf6de7b6cfd..b2f223e7ccdc 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -104,6 +104,7 @@ in discourse = handleTest ./discourse.nix {}; dnscrypt-proxy2 = handleTestOn ["x86_64-linux"] ./dnscrypt-proxy2.nix {}; dnscrypt-wrapper = handleTestOn ["x86_64-linux"] ./dnscrypt-wrapper {}; + dnsdist = handleTest ./dnsdist.nix {}; doas = handleTest ./doas.nix {}; docker = handleTestOn ["x86_64-linux"] ./docker.nix {}; docker-rootless = handleTestOn ["x86_64-linux"] ./docker-rootless.nix {}; diff --git a/nixos/tests/dnsdist.nix b/nixos/tests/dnsdist.nix new file mode 100644 index 000000000000..cfc41c13864e --- /dev/null +++ b/nixos/tests/dnsdist.nix @@ -0,0 +1,48 @@ +import ./make-test-python.nix ( + { pkgs, ... }: { + name = "dnsdist"; + meta = with pkgs.lib; { + maintainers = with maintainers; [ jojosch ]; + }; + + machine = { pkgs, lib, ... }: { + services.bind = { + enable = true; + extraOptions = "empty-zones-enable no;"; + zones = lib.singleton { + name = "."; + master = true; + file = pkgs.writeText "root.zone" '' + $TTL 3600 + . IN SOA ns.example.org. admin.example.org. ( 1 3h 1h 1w 1d ) + . IN NS ns.example.org. + + ns.example.org. IN A 192.168.0.1 + ns.example.org. IN AAAA abcd::1 + + 1.0.168.192.in-addr.arpa IN PTR ns.example.org. + ''; + }; + }; + services.dnsdist = { + enable = true; + listenPort = 5353; + extraConfig = '' + newServer({address="127.0.0.1:53", name="local-bind"}) + ''; + }; + + environment.systemPackages = with pkgs; [ dig ]; + }; + + testScript = '' + machine.wait_for_unit("bind.service") + machine.wait_for_open_port(53) + machine.succeed("dig @127.0.0.1 +short -x 192.168.0.1 | grep -qF ns.example.org") + + machine.wait_for_unit("dnsdist.service") + machine.wait_for_open_port(5353) + machine.succeed("dig @127.0.0.1 -p 5353 +short -x 192.168.0.1 | grep -qF ns.example.org") + ''; + } +) |