summaryrefslogtreecommitdiffstats
path: root/nixos/tests/whois.nix
blob: 49ec707e26312ca1df7193cef20fb8f66e43becf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib, ... }:
{
  name = "whois";
  meta.maintainers = with lib.maintainers; [ Cryolitia ];

  nodes.machine = {
    imports = [ ../modules/profiles/minimal.nix ];

    programs.whois = {
      enable = true;
      settings = [
        {
          pattern = "\\.dn42$";
          server = "whois.dn42";
        }
        {
          pattern = "\\-DN42$";
          server = "whois.dn42";
        }
        {
          pattern = "^as424242[0-9]{4}$";
          server = "whois.dn42";
        }
      ];
    };
  };

  testScript = ''
    start_all()

    machine.succeed("command -v whois")

    whois_conf = machine.succeed("cat /etc/whois.conf").strip()
    expected = """
    # Generated by NixOS.
    # See whois.conf(5) for the file format.
    \\.dn42$ whois.dn42
    \\-DN42$ whois.dn42
    ^as424242[0-9]{4}$ whois.dn42
    """.strip()
    assert whois_conf == expected
  '';
}