Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

nixos/tests: add basic test for services.atd

(cherry picked from commit 943730ff9b6b05c61ef75d7e2f3fae17d4cbdf4f)

(Fix trivial conflict in nixos/release.nix.)

Changed files
+37
nixos
+1
nixos/release.nix
··· 214 214 # Run the tests for each platform. You can run a test by doing 215 215 # e.g. ‘nix-build -A tests.login.x86_64-linux’, or equivalently, 216 216 # ‘nix-build tests/login.nix -A result’. 217 + tests.atd = callTest tests/atd.nix {}; 217 218 tests.avahi = callTest tests/avahi.nix {}; 218 219 tests.bittorrent = callTest tests/bittorrent.nix {}; 219 220 tests.blivet = callTest tests/blivet.nix {};
+36
nixos/tests/atd.nix
··· 1 + import ./make-test.nix ({ pkgs, lib, ... }: 2 + 3 + { 4 + name = "atd"; 5 + meta = with pkgs.stdenv.lib.maintainers; { 6 + maintainers = [ bjornfor ]; 7 + }; 8 + 9 + machine = 10 + { config, pkgs, ... }: 11 + { services.atd.enable = true; 12 + users.extraUsers.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 ~root/batch-1"); 21 + $machine->fail("test -f ~alice/at-1"); 22 + $machine->fail("test -f ~alice/batch-1"); 23 + 24 + $machine->succeed("echo 'touch ~root/at-1' | at now+1min"); 25 + $machine->succeed("echo 'touch ~root/batch-1' | batch"); 26 + $machine->succeed("su - alice -c \"echo 'touch at-1' | at now+1min\""); 27 + $machine->succeed("su - alice -c \"echo 'touch batch-1' | batch\""); 28 + 29 + $machine->succeed("sleep 1.5m"); 30 + 31 + $machine->succeed("test -f ~root/at-1"); 32 + $machine->succeed("test -f ~root/batch-1"); 33 + $machine->succeed("test -f ~alice/at-1"); 34 + $machine->succeed("test -f ~alice/batch-1"); 35 + ''; 36 + })