blob: c15ad62c00852e559609e18349b8777b760290de (
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
|
{ lib, pkgs, ... }:
{
name = "powerdns-recursor";
meta.maintainers = with lib.maintainers; [ rnhmjoj ];
nodes.server = {
services.pdns-recursor.enable = true;
services.pdns-recursor.api.enable = true;
services.pdns-recursor.exportHosts = true;
services.pdns-recursor.settings.webservice.api_key = "supersecret";
networking.hosts."192.0.2.1" = [ "example.com" ];
};
testScript = ''
with subtest("pdns-recursor is running"):
server.wait_for_unit("pdns-recursor")
server.wait_for_open_port(53)
with subtest("can resolve names"):
assert "192.0.2.1" in server.succeed("host example.com localhost")
with subtest("api is working"):
server.wait_for_open_port(8082)
server.succeed("curl -f -H 'X-API-Key: supersecret' http://localhost:8082/api/v1/servers")
server.fail("curl -f http://localhost:8082/api/v1/servers")
with subtest("metrics are exported"):
assert "pdns_recursor_" in server.succeed("curl -f -H 'X-API-Key: supersecret' http://localhost:8082/metrics")
'';
}
|