2018-07-20 23:56:59 +03:00
|
|
|
import ./make-test.nix ({ pkgs, ... }:
|
2017-10-14 23:38:10 +03:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "atd";
|
|
|
|
meta = with pkgs.stdenv.lib.maintainers; {
|
|
|
|
maintainers = [ bjornfor ];
|
|
|
|
};
|
|
|
|
|
|
|
|
machine =
|
2018-07-20 23:56:59 +03:00
|
|
|
{ ... }:
|
2017-10-14 23:38:10 +03:00
|
|
|
{ services.atd.enable = true;
|
2018-06-30 02:55:42 +03:00
|
|
|
users.users.alice = { isNormalUser = true; };
|
2017-10-14 23:38:10 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
# "at" has a resolution of 1 minute
|
|
|
|
testScript = ''
|
|
|
|
startAll;
|
|
|
|
|
2018-09-21 10:22:03 +03:00
|
|
|
$machine->waitForUnit('atd.service'); # wait for atd to start
|
2017-10-14 23:38:10 +03:00
|
|
|
$machine->fail("test -f ~root/at-1");
|
|
|
|
$machine->fail("test -f ~alice/at-1");
|
|
|
|
|
|
|
|
$machine->succeed("echo 'touch ~root/at-1' | at now+1min");
|
|
|
|
$machine->succeed("su - alice -c \"echo 'touch at-1' | at now+1min\"");
|
|
|
|
|
|
|
|
$machine->succeed("sleep 1.5m");
|
|
|
|
|
|
|
|
$machine->succeed("test -f ~root/at-1");
|
|
|
|
$machine->succeed("test -f ~alice/at-1");
|
|
|
|
'';
|
|
|
|
})
|