nixpkgs/nixos/tests/rsyslogd.nix
Léo Gaspard 6c68fbd4e1
tests: refactor to carry the package set as an argument
This way, the package set will be possible to pass without re-importing
all the time
2018-11-11 23:11:45 +09:00

43 lines
1.0 KiB
Nix

{ system ? builtins.currentSystem,
config ? {},
pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing.nix { inherit system pkgs; };
with pkgs.lib;
{
test1 = makeTest {
name = "rsyslogd-test1";
meta.maintainers = [ maintainers.aanderse ];
machine =
{ config, pkgs, ... }:
{ services.rsyslogd.enable = true;
services.journald.forwardToSyslog = false;
};
# ensure rsyslogd isn't receiving messages from journald if explicitly disabled
testScript = ''
$machine->waitForUnit("default.target");
$machine->fail("test -f /var/log/messages");
'';
};
test2 = makeTest {
name = "rsyslogd-test2";
meta.maintainers = [ maintainers.aanderse ];
machine =
{ config, pkgs, ... }:
{ services.rsyslogd.enable = true;
};
# ensure rsyslogd is receiving messages from journald
testScript = ''
$machine->waitForUnit("default.target");
$machine->succeed("test -f /var/log/messages");
'';
};
}