2019-11-05 11:11:56 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }:
|
2017-10-14 21:38:10 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "atd";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2017-10-14 21:38:10 +01:00
|
|
|
maintainers = [ bjornfor ];
|
|
|
|
};
|
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine =
|
2018-07-20 21:56:59 +01:00
|
|
|
{ ... }:
|
2017-10-14 21:38:10 +01:00
|
|
|
{ services.atd.enable = true;
|
2018-06-30 00:55:42 +01:00
|
|
|
users.users.alice = { isNormalUser = true; };
|
2017-10-14 21:38:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# "at" has a resolution of 1 minute
|
|
|
|
testScript = ''
|
2019-11-05 11:11:56 +00:00
|
|
|
start_all()
|
2017-10-14 21:38:10 +01:00
|
|
|
|
2019-11-05 11:11:56 +00:00
|
|
|
machine.wait_for_unit("atd.service") # wait for atd to start
|
|
|
|
machine.fail("test -f ~root/at-1")
|
|
|
|
machine.fail("test -f ~alice/at-1")
|
2017-10-14 21:38:10 +01:00
|
|
|
|
2019-11-05 11:11:56 +00:00
|
|
|
machine.succeed("echo 'touch ~root/at-1' | at now+1min")
|
|
|
|
machine.succeed("su - alice -c \"echo 'touch at-1' | at now+1min\"")
|
2017-10-14 21:38:10 +01:00
|
|
|
|
2019-11-05 11:11:56 +00:00
|
|
|
machine.succeed("sleep 1.5m")
|
2017-10-14 21:38:10 +01:00
|
|
|
|
2019-11-05 11:11:56 +00:00
|
|
|
machine.succeed("test -f ~root/at-1")
|
|
|
|
machine.succeed("test -f ~alice/at-1")
|
2017-10-14 21:38:10 +01:00
|
|
|
'';
|
|
|
|
})
|