nixosTests.nscd: dump nscd socket info with sockdump

This dumps what's sent over the nscd socket to the console output, which
allows debugging.
This commit is contained in:
Florian Klink 2022-10-10 08:19:10 +02:00
parent aee40c2d8a
commit e7bc3e7504

View File

@ -21,6 +21,24 @@ in
192.0.2.1 somehost.test
'';
systemd.services.sockdump = {
wantedBy = [ "multi-user.target" ];
path = [
# necessary for bcc to unpack kernel headers and invoke modprobe
pkgs.gnutar
pkgs.xz.bin
pkgs.kmod
];
environment.PYTHONUNBUFFERED = "1";
serviceConfig = {
ExecStart = "${pkgs.sockdump}/bin/sockdump /var/run/nscd/socket";
Restart = "on-failure";
RestartSec = "1";
Type = "simple";
};
};
specialisation = {
withUnscd.configuration = { ... }: {
services.nscd.package = pkgs.unscd;
@ -63,6 +81,7 @@ in
assert "somehost.test" in machine.succeed("${getent'} hosts 2001:db8::1")
assert "somehost.test" in machine.succeed("${getent'} hosts 192.0.2.1")
# Test host resolution via nss modules works
# We rely on nss-myhostname in this case, which resolves *.localhost and
# _gateway.
@ -88,6 +107,9 @@ in
start_all()
machine.wait_for_unit("default.target")
# give sockdump some time to finish attaching.
machine.sleep(5)
# Test all tests with glibc-nscd.
test_dynamic_user()
test_host_lookups()