about summary refs log tree commit diff
path: root/nixos/tests/rsyslogd.nix
blob: 049acdcd43934520ed81c15da14cd16482c84762 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ system ? builtins.currentSystem,
  config ? {},
  pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;

{
  test1 = makeTest {
    name = "rsyslogd-test1";
    meta.maintainers = [ pkgs.lib.maintainers.aanderse ];

    nodes.machine = { config, pkgs, ... }: {
      services.rsyslogd.enable = true;
      services.journald.forwardToSyslog = false;
    };

    # ensure rsyslogd isn't receiving messages from journald if explicitly disabled
    testScript = ''
      machine.wait_for_unit("default.target")
      machine.fail("test -f /var/log/messages")
    '';
  };

  test2 = makeTest {
    name = "rsyslogd-test2";
    meta.maintainers = [ pkgs.lib.maintainers.aanderse ];

    nodes.machine = { config, pkgs, ... }: {
      services.rsyslogd.enable = true;
    };

    # ensure rsyslogd is receiving messages from journald
    testScript = ''
      machine.wait_for_unit("default.target")
      machine.succeed("test -f /var/log/messages")
    '';
  };
}