Merge pull request #267880 from Izorkin/update-nixos-tests-logrotate
This commit is contained in:
commit
04f0aed442
2 changed files with 51 additions and 41 deletions
|
@ -218,6 +218,8 @@ in
|
||||||
|
|
||||||
services.displayManager.logToJournal = true;
|
services.displayManager.logToJournal = true;
|
||||||
|
|
||||||
|
services.logrotate.enable = lib.mkDefault false;
|
||||||
|
|
||||||
# Make sure we use the Guest Agent from the QEMU package for testing
|
# Make sure we use the Guest Agent from the QEMU package for testing
|
||||||
# to reduce the closure size required for the tests.
|
# to reduce the closure size required for the tests.
|
||||||
services.qemuGuest.package = pkgs.qemu_test.ga;
|
services.qemuGuest.package = pkgs.qemu_test.ga;
|
||||||
|
|
|
@ -16,52 +16,60 @@ import ./make-test-python.nix ({ pkgs, ... }: rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
defaultMachine = { ... }: { };
|
defaultMachine = { ... }: {
|
||||||
|
services.logrotate.enable = true;
|
||||||
|
};
|
||||||
failingMachine = { ... }: {
|
failingMachine = { ... }: {
|
||||||
services.logrotate.configFile = pkgs.writeText "logrotate.conf" ''
|
services.logrotate = {
|
||||||
# self-written config file
|
enable = true;
|
||||||
su notarealuser notagroupeither
|
configFile = pkgs.writeText "logrotate.conf" ''
|
||||||
'';
|
# self-written config file
|
||||||
|
su notarealuser notagroupeither
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
machine = { config, ... }: {
|
machine = { config, ... }: {
|
||||||
imports = [ importTest ];
|
imports = [ importTest ];
|
||||||
|
|
||||||
services.logrotate.settings = {
|
services.logrotate = {
|
||||||
# remove default frequency header and add another
|
enable = true;
|
||||||
header = {
|
settings = {
|
||||||
frequency = null;
|
# remove default frequency header and add another
|
||||||
delaycompress = true;
|
header = {
|
||||||
};
|
frequency = null;
|
||||||
# extra global setting... affecting nothing
|
delaycompress = true;
|
||||||
last_line = {
|
};
|
||||||
global = true;
|
# extra global setting... affecting nothing
|
||||||
priority = 2000;
|
last_line = {
|
||||||
shred = true;
|
global = true;
|
||||||
};
|
priority = 2000;
|
||||||
# using mail somewhere should add --mail to logrotate invocation
|
shred = true;
|
||||||
sendmail = {
|
};
|
||||||
mail = "user@domain.tld";
|
# using mail somewhere should add --mail to logrotate invocation
|
||||||
};
|
sendmail = {
|
||||||
# postrotate should be suffixed by 'endscript'
|
mail = "user@domain.tld";
|
||||||
postrotate = {
|
};
|
||||||
postrotate = "touch /dev/null";
|
# postrotate should be suffixed by 'endscript'
|
||||||
};
|
postrotate = {
|
||||||
# check checkConfig works as expected: there is nothing to check here
|
postrotate = "touch /dev/null";
|
||||||
# except that the file build passes
|
};
|
||||||
checkConf = {
|
# check checkConfig works as expected: there is nothing to check here
|
||||||
su = "root utmp";
|
# except that the file build passes
|
||||||
createolddir = "0750 root utmp";
|
checkConf = {
|
||||||
create = "root utmp";
|
su = "root utmp";
|
||||||
"create " = "0750 root utmp";
|
createolddir = "0750 root utmp";
|
||||||
};
|
create = "root utmp";
|
||||||
# multiple paths should be aggregated
|
"create " = "0750 root utmp";
|
||||||
multipath = {
|
};
|
||||||
files = [ "file1" "file2" ];
|
# multiple paths should be aggregated
|
||||||
};
|
multipath = {
|
||||||
# overriding imported path should keep existing attributes
|
files = [ "file1" "file2" ];
|
||||||
# (e.g. olddir is still set)
|
};
|
||||||
import = {
|
# overriding imported path should keep existing attributes
|
||||||
notifempty = true;
|
# (e.g. olddir is still set)
|
||||||
|
import = {
|
||||||
|
notifempty = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue