diff options
author | Florian Klink <flokli@flokli.de> | 2019-12-05 21:42:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-05 21:42:33 +0100 |
commit | ea9c3b934265d12129c0ec6ead48fabd87c0c050 (patch) | |
tree | fdb4687feca7bf72bcf694e5d44e01f1129fbf2f /nixos/tests | |
parent | 47a87462e3032d105fe361d9849ae21e0fcfbb12 (diff) | |
parent | 8d36536c2e998c4885bbaf25c2f05634b0473405 (diff) | |
download | nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.tar nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.tar.gz nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.tar.bz2 nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.tar.lz nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.tar.xz nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.tar.zst nixlib-ea9c3b934265d12129c0ec6ead48fabd87c0c050.zip |
Merge pull request #74032 from ckauhaus/remove-networking.hostconf
Remove networking.hostConf option
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/resolv.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nixos/tests/resolv.nix b/nixos/tests/resolv.nix new file mode 100644 index 000000000000..b506f87451ee --- /dev/null +++ b/nixos/tests/resolv.nix @@ -0,0 +1,46 @@ +# Test whether DNS resolving returns multiple records and all address families. +import ./make-test-python.nix ({ pkgs, ... } : { + name = "resolv"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ ckauhaus ]; + }; + + nodes.resolv = { ... }: { + networking.extraHosts = '' + # IPv4 only + 192.0.2.1 host-ipv4.example.net + 192.0.2.2 host-ipv4.example.net + # IP6 only + 2001:db8::2:1 host-ipv6.example.net + 2001:db8::2:2 host-ipv6.example.net + # dual stack + 192.0.2.1 host-dual.example.net + 192.0.2.2 host-dual.example.net + 2001:db8::2:1 host-dual.example.net + 2001:db8::2:2 host-dual.example.net + ''; + }; + + testScript = '' + def addrs_in(hostname, addrs): + res = resolv.succeed("getent ahosts {}".format(hostname)) + for addr in addrs: + assert addr in res, "Expected output '{}' not found in\n{}".format(addr, res) + + + start_all() + resolv.wait_for_unit("nscd") + + ipv4 = ["192.0.2.1", "192.0.2.2"] + ipv6 = ["2001:db8::2:1", "2001:db8::2:2"] + + with subtest("IPv4 resolves"): + addrs_in("host-ipv4.example.net", ipv4) + + with subtest("IPv6 resolves"): + addrs_in("host-ipv6.example.net", ipv6) + + with subtest("Dual stack resolves"): + addrs_in("host-dual.example.net", ipv4 + ipv6) + ''; +}) |