3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/tests/tuptime.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
879 B
Nix
Raw Normal View History

2020-03-24 22:45:49 +00:00
import ./make-test-python.nix ({ pkgs, ...} : {
name = "tuptime";
meta = with pkgs.lib.maintainers; {
2020-03-24 22:45:49 +00:00
maintainers = [ evils ];
};
2022-03-20 23:15:30 +00:00
nodes.machine = { pkgs, ... }: {
2020-03-24 22:45:49 +00:00
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()
'';
})