diff options
author | Janne Heß <janne@hess.ooo> | 2022-02-28 10:19:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 10:19:25 +0100 |
commit | d32ba3f4b0c88533e745649d73b4b28039885dc2 (patch) | |
tree | 1d0057394aab2ecb2200df6db0d9e6c166eda605 /nixos/tests | |
parent | ef8c2381d71b81c8586dc59ca57f1d45444d3f19 (diff) | |
parent | 8022c82a39c19bd1fe000884703601532204b82f (diff) | |
download | nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.tar nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.tar.gz nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.tar.bz2 nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.tar.lz nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.tar.xz nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.tar.zst nixlib-d32ba3f4b0c88533e745649d73b4b28039885dc2.zip |
Merge pull request #161929 from martinetd/switchTest
logrotate: do not enable logrotate.service itself
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/logrotate.nix | 17 | ||||
-rw-r--r-- | nixos/tests/switch-test.nix | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/nixos/tests/logrotate.nix b/nixos/tests/logrotate.nix index 5a724d9d6e94..38da8d535275 100644 --- a/nixos/tests/logrotate.nix +++ b/nixos/tests/logrotate.nix @@ -15,20 +15,21 @@ import ./make-test-python.nix ({ pkgs, ...} : rec { with subtest("whether logrotate works"): machine.succeed( # we must rotate once first to create logrotate stamp - "systemctl start --wait logrotate.service", + "systemctl start logrotate.service") + # we need to wait for console text once here to + # clear console buffer up to this point for next wait + machine.wait_for_console_text('logrotate.service: Deactivated successfully') + machine.succeed( # wtmp is present in default config. "rm -f /var/log/wtmp*", # we need to give it at least 1MB "dd if=/dev/zero of=/var/log/wtmp bs=2M count=1", - # move into the future and rotate - "date -s 'now + 1 month + 1 day'", - # systemd will run logrotate from logrotate.timer automatically - # on date change, but if we want to wait for it to terminate - # it's easier to run again... - "systemctl start --wait logrotate.service", - + # move into the future and check rotation. + "date -s 'now + 1 month + 1 day'") + machine.wait_for_console_text('logrotate.service: Deactivated successfully') + machine.succeed( # check rotate worked "[ -e /var/log/wtmp.1 ]", ) diff --git a/nixos/tests/switch-test.nix b/nixos/tests/switch-test.nix index 4f297b6521d1..b429babce838 100644 --- a/nixos/tests/switch-test.nix +++ b/nixos/tests/switch-test.nix @@ -283,6 +283,7 @@ import ./make-test-python.nix ({ pkgs, ...} : { systemd.services.test-watch = { serviceConfig = { Type = "oneshot"; + RemainAfterExit = true; ExecStart = "${pkgs.coreutils}/bin/touch /testpath-modified"; }; }; @@ -723,6 +724,7 @@ import ./make-test-python.nix ({ pkgs, ...} : { machine.succeed("touch /testpath") machine.wait_until_succeeds("test -f /testpath-modified") machine.succeed("rm /testpath /testpath-modified") + machine.systemctl("stop test-watch.service") switch_to_specialisation("${machine}", "pathModified") machine.succeed("touch /testpath") machine.fail("test -f /testpath-modified") |