about summary refs log tree commit diff
path: root/nixos/tests/smokeping.nix
blob: 04f813964291801fbc133921a8bcaf07d304a674 (plain) (blame)
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
import ./make-test-python.nix ({ pkgs, ...} : {
  name = "smokeping";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ cransom ];
  };

  nodes = {
    sm =
      { ... }:
      {
        networking.domain = "example.com"; # FQDN: sm.example.com
        services.smokeping = {
          enable = true;
          port = 8081;
          mailHost = "127.0.0.2";
          probeConfig = ''
            + FPing
            binary = /run/wrappers/bin/fping
            offset = 0%
          '';
        };
      };
  };

  testScript = ''
    start_all()
    sm.wait_for_unit("smokeping")
    sm.wait_for_unit("thttpd")
    sm.wait_for_file("/var/lib/smokeping/data/Local/LocalMachine.rrd")
    sm.succeed("curl -s -f localhost:8081/smokeping.fcgi?target=Local")
    # Check that there's a helpful page without explicit path as well.
    sm.succeed("curl -s -f localhost:8081")
    sm.succeed("ls /var/lib/smokeping/cache/Local/LocalMachine_mini.png")
    sm.succeed("ls /var/lib/smokeping/cache/index.html")
  '';
})