1import ./make-test-python.nix ({ pkgs, ... }:
2
3{
4 name = "atd";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ bjornfor ];
7 };
8
9 nodes.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 start_all()
18
19 machine.wait_for_unit("atd.service") # wait for atd to start
20 machine.fail("test -f ~root/at-1")
21 machine.fail("test -f ~alice/at-1")
22
23 machine.succeed("echo 'touch ~root/at-1' | at now+1min")
24 machine.succeed("su - alice -c \"echo 'touch at-1' | at now+1min\"")
25
26 machine.succeed("sleep 1.5m")
27
28 machine.succeed("test -f ~root/at-1")
29 machine.succeed("test -f ~alice/at-1")
30 '';
31})