2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
|
|
|
name = "smokeping";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ cransom ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
sm =
|
|
|
|
{ ... }:
|
|
|
|
{
|
2021-02-05 17:12:51 +00:00
|
|
|
networking.domain = "example.com"; # FQDN: sm.example.com
|
2020-04-24 23:36:52 +00:00
|
|
|
services.smokeping = {
|
|
|
|
enable = true;
|
|
|
|
mailHost = "127.0.0.2";
|
|
|
|
probeConfig = ''
|
|
|
|
+ FPing
|
|
|
|
binary = /run/wrappers/bin/fping
|
|
|
|
offset = 0%
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
sm.wait_for_unit("smokeping")
|
2024-05-15 15:35:15 +00:00
|
|
|
sm.wait_for_unit("nginx")
|
2020-04-24 23:36:52 +00:00
|
|
|
sm.wait_for_file("/var/lib/smokeping/data/Local/LocalMachine.rrd")
|
2024-05-15 15:35:15 +00:00
|
|
|
sm.succeed("curl -s -f localhost/smokeping.fcgi?target=Local")
|
2022-10-30 15:09:59 +00:00
|
|
|
# Check that there's a helpful page without explicit path as well.
|
2024-05-15 15:35:15 +00:00
|
|
|
sm.succeed("curl -s -f localhost")
|
2020-04-24 23:36:52 +00:00
|
|
|
sm.succeed("ls /var/lib/smokeping/cache/Local/LocalMachine_mini.png")
|
|
|
|
sm.succeed("ls /var/lib/smokeping/cache/index.html")
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# stop and start the service like nixos-rebuild would do
|
|
|
|
# see https://github.com/NixOS/nixpkgs/issues/265953)
|
|
|
|
sm.succeed("systemctl stop smokeping")
|
|
|
|
sm.succeed("systemctl start smokeping")
|
|
|
|
# ensure all services restarted properly
|
|
|
|
sm.succeed("systemctl --failed | grep -q '0 loaded units listed'")
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
})
|