summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrimmauld <Grimmauld@grimmauld.de>2025-08-10 19:30:28 +0200
committerGrimmauld <Grimmauld@grimmauld.de>2025-08-11 10:37:56 +0200
commit122c5aa7d98f912aadc2c6d1e7dd2db1dc5f5323 (patch)
tree0ece3746b0a2f9d54406baf508ffb1b487ff7a79
parentnixos/pam: fix lastlog2 import service (diff)
downloadnixpkgs-122c5aa7d98f912aadc2c6d1e7dd2db1dc5f5323.tar.gz
nixos/tests/pam-lastlog: test legacy lastlog importer
-rw-r--r--nixos/tests/pam/pam-lastlog.nix17
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")
'';
}