1import ./make-test.nix ({ pkgs, ... }:
2
3{
4 name = "atd";
5 meta = with pkgs.stdenv.lib.maintainers; {
6 maintainers = [ bjornfor ];
7 };
8
9 machine =
10 { ... }:
11 { services.atd.enable = true;
12 users.users.alice = { isNormalUser = true; };
13 };
14
15 # "at" has a resolution of 1 minute
16 testScript = ''
17 startAll;
18
19 $machine->fail("test -f ~root/at-1");
20 $machine->fail("test -f ~alice/at-1");
21
22 $machine->succeed("echo 'touch ~root/at-1' | at now+1min");
23 $machine->succeed("su - alice -c \"echo 'touch at-1' | at now+1min\"");
24
25 $machine->succeed("sleep 1.5m");
26
27 $machine->succeed("test -f ~root/at-1");
28 $machine->succeed("test -f ~alice/at-1");
29 '';
30})