2019-11-05 12:11:56 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }:
|
2017-10-14 22:38:10 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "atd";
|
2021-01-10 20:08:30 +01:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2017-10-14 22:38:10 +02:00
|
|
|
maintainers = [ bjornfor ];
|
|
|
|
};
|
|
|
|
|
|
|
|
machine =
|
2018-07-20 22:56:59 +02:00
|
|
|
{ ... }:
|
2017-10-14 22:38:10 +02:00
|
|
|
{ services.atd.enable = true;
|
2018-06-30 01:55:42 +02:00
|
|
|
users.users.alice = { isNormalUser = true; };
|
2017-10-14 22:38:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# "at" has a resolution of 1 minute
|
|
|
|
testScript = ''
|
2019-11-05 12:11:56 +01:00
|
|
|
start_all()
|
2017-10-14 22:38:10 +02:00
|
|
|
|
2019-11-05 12:11:56 +01: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 22:38:10 +02:00
|
|
|
|
2019-11-05 12:11:56 +01: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 22:38:10 +02:00
|
|
|
|
2019-11-05 12:11:56 +01:00
|
|
|
machine.succeed("sleep 1.5m")
|
2017-10-14 22:38:10 +02:00
|
|
|
|
2019-11-05 12:11:56 +01:00
|
|
|
machine.succeed("test -f ~root/at-1")
|
|
|
|
machine.succeed("test -f ~alice/at-1")
|
2017-10-14 22:38:10 +02:00
|
|
|
'';
|
|
|
|
})
|