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