nixosTests.tuptime: init test

This commit is contained in:
Evils 2020-03-24 23:45:49 +01:00
parent b29d48acfb
commit b7b99c93f5
2 changed files with 30 additions and 0 deletions

View file

@ -308,6 +308,7 @@ in
trilium-server = handleTestOn ["x86_64-linux"] ./trilium-server.nix {};
trezord = handleTest ./trezord.nix {};
trickster = handleTest ./trickster.nix {};
tuptime = handleTest ./tuptime.nix {};
udisks2 = handleTest ./udisks2.nix {};
upnp = handleTest ./upnp.nix {};
uwsgi = handleTest ./uwsgi.nix {};

29
nixos/tests/tuptime.nix Normal file
View file

@ -0,0 +1,29 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "tuptime";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ evils ];
};
machine = { pkgs, ... }: {
imports = [ ../modules/profiles/minimal.nix ];
services.tuptime.enable = true;
};
testScript =
''
# see if it starts
start_all()
machine.wait_for_unit("multi-user.target")
machine.succeed("tuptime | grep 'System startups:[[:blank:]]*1'")
machine.succeed("tuptime | grep 'System uptime:[[:blank:]]*100.0%'")
machine.shutdown()
# restart machine and see if it correctly reports the reboot
machine.start()
machine.wait_for_unit("multi-user.target")
machine.succeed("tuptime | grep 'System startups:[[:blank:]]*2'")
machine.succeed("tuptime | grep 'System shutdowns:[[:blank:]]*1 ok'")
machine.shutdown()
'';
})