2019-11-05 14:11:56 +03:00
|
|
|
import ./make-test-python.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 = ''
|
2019-11-05 14:11:56 +03:00
|
|
|
start_all()
|
2017-10-14 23:38:10 +03:00
|
|
|
|
2019-11-05 14:11:56 +03: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 23:38:10 +03:00
|
|
|
|
2019-11-05 14:11:56 +03: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 23:38:10 +03:00
|
|
|
|
2019-11-05 14:11:56 +03:00
|
|
|
machine.succeed("sleep 1.5m")
|
2017-10-14 23:38:10 +03:00
|
|
|
|
2019-11-05 14:11:56 +03:00
|
|
|
machine.succeed("test -f ~root/at-1")
|
|
|
|
machine.succeed("test -f ~alice/at-1")
|
2017-10-14 23:38:10 +03:00
|
|
|
'';
|
|
|
|
})
|