1import ./make-test-python.nix (
2 { pkgs, ... }:
3 {
4 name = "smokeping";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ cransom ];
7 };
8
9 nodes = {
10 sm =
11 { ... }:
12 {
13 networking.domain = "example.com"; # FQDN: sm.example.com
14 services.smokeping = {
15 enable = true;
16 mailHost = "127.0.0.2";
17 probeConfig = ''
18 + FPing
19 binary = /run/wrappers/bin/fping
20 offset = 0%
21 '';
22 };
23 };
24 };
25
26 testScript = ''
27 start_all()
28 sm.wait_for_unit("smokeping")
29 sm.wait_for_unit("nginx")
30 sm.wait_for_file("/var/lib/smokeping/data/Local/LocalMachine.rrd")
31 sm.succeed("curl -s -f localhost/smokeping.fcgi?target=Local")
32 # Check that there's a helpful page without explicit path as well.
33 sm.succeed("curl -s -f localhost")
34 sm.succeed("ls /var/lib/smokeping/cache/Local/LocalMachine_mini.png")
35 sm.succeed("ls /var/lib/smokeping/cache/index.html")
36
37 # stop and start the service like nixos-rebuild would do
38 # see https://github.com/NixOS/nixpkgs/issues/265953)
39 sm.succeed("systemctl stop smokeping")
40 sm.succeed("systemctl start smokeping")
41 # ensure all services restarted properly
42 sm.succeed("systemctl --failed | grep -q '0 loaded units listed'")
43 '';
44 }
45)