diff options
| author | Grimmauld <Grimmauld@grimmauld.de> | 2025-08-10 19:30:28 +0200 |
|---|---|---|
| committer | Grimmauld <Grimmauld@grimmauld.de> | 2025-08-11 10:37:56 +0200 |
| commit | 122c5aa7d98f912aadc2c6d1e7dd2db1dc5f5323 (patch) | |
| tree | 0ece3746b0a2f9d54406baf508ffb1b487ff7a79 | |
| parent | nixos/pam: fix lastlog2 import service (diff) | |
| download | nixpkgs-122c5aa7d98f912aadc2c6d1e7dd2db1dc5f5323.tar.gz | |
nixos/tests/pam-lastlog: test legacy lastlog importer
| -rw-r--r-- | nixos/tests/pam/pam-lastlog.nix | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/nixos/tests/pam/pam-lastlog.nix b/nixos/tests/pam/pam-lastlog.nix index 837c84e1e601..cefc8a3d4e45 100644 --- a/nixos/tests/pam/pam-lastlog.nix +++ b/nixos/tests/pam/pam-lastlog.nix @@ -13,9 +13,18 @@ }; testScript = '' - machine.wait_for_unit("multi-user.target") - machine.succeed("run0 --pty true") # perform full login - print(machine.succeed("lastlog2 --active --user root")) - machine.succeed("stat /var/lib/lastlog/lastlog2.db") + with subtest("Test legacy lastlog import"): + # create old lastlog file to test import + # empty = nothing will actually be imported, but the service will run + machine.succeed("touch /var/log/lastlog") + machine.wait_for_unit("lastlog2-import.service") + machine.succeed("journalctl -b --grep 'Starting Import lastlog data into lastlog2 database'") + machine.succeed("stat /var/log/lastlog.migrated") + + with subtest("Test lastlog entries are created by logins"): + machine.wait_for_unit("multi-user.target") + machine.succeed("run0 --pty true") # perform full login + print(machine.succeed("lastlog2 --active --user root")) + machine.succeed("stat /var/lib/lastlog/lastlog2.db") ''; } |
