Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3bf5411996f9
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 316ad9625648
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Nov 11, 2018

  1. Copy the full SHA
    24af0bc View commit details
  2. Merge pull request #50210 from aanderse/incron

    nixos/incron: added nixos test to ensure expected behaviour
    infinisil authored Nov 11, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    316ad96 View commit details
Showing with 53 additions and 0 deletions.
  1. +1 −0 nixos/release.nix
  2. +52 −0 nixos/tests/incron.nix
1 change: 1 addition & 0 deletions nixos/release.nix
Original file line number Diff line number Diff line change
@@ -336,6 +336,7 @@ in rec {
tests.plasma5 = callTest tests/plasma5.nix {};
tests.plotinus = callTest tests/plotinus.nix {};
tests.keymap = callSubTests tests/keymap.nix {};
tests.incron = callTest tests/incron.nix {};
tests.initrdNetwork = callTest tests/initrd-network.nix {};
tests.kafka = callSubTests tests/kafka.nix {};
tests.kernel-latest = callTest tests/kernel-latest.nix {};
52 changes: 52 additions & 0 deletions nixos/tests/incron.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import ./make-test.nix ({ pkgs, lib, ... }:

{
name = "incron";
meta.maintainers = [ lib.maintainers.aanderse ];

machine =
{ ... }:
{ services.incron.enable = true;
services.incron.extraPackages = [ pkgs.coreutils ];
services.incron.systab = ''
/test IN_CREATE,IN_MODIFY,IN_CLOSE_WRITE,IN_MOVED_FROM,IN_MOVED_TO echo "$@/$# $%" >> /root/incron.log
'';

# ensure the directory to be monitored exists before incron is started
system.activationScripts.incronTest = ''
mkdir /test
'';
};

testScript = ''
startAll;
$machine->waitForUnit("multi-user.target");
$machine->waitForUnit("incron.service");
$machine->succeed("test -d /test");
# create some activity for incron to monitor
$machine->succeed("touch /test/file");
$machine->succeed("echo foo >> /test/file");
$machine->succeed("mv /test/file /root");
$machine->succeed("mv /root/file /test");
$machine->sleep(1);
# touch /test/file
$machine->succeed("grep '/test/file IN_CREATE' /root/incron.log");
# echo foo >> /test/file
$machine->succeed("grep '/test/file IN_MODIFY' /root/incron.log");
$machine->succeed("grep '/test/file IN_CLOSE_WRITE' /root/incron.log");
# mv /test/file /root
$machine->succeed("grep '/test/file IN_MOVED_FROM' /root/incron.log");
# mv /root/file /test
$machine->succeed("grep '/test/file IN_MOVED_TO' /root/incron.log");
# ensure something unexpected is not present
$machine->fail("grep 'IN_OPEN' /root/incron.log");
'';
})