Files
nixpkgs/nixos/tests/munge.nix
Maximilian Bosch 65bc98e452 nixos/tests: fix eval of several tests
The addition of the nspawn backend introduced a second argument passed
to the attribute-set passed to `testScript`, i.e. containers[1].

Note: this is by no means intended to replace the compat fix from #501599,
I believe we shouldn't have deprecated invocations in-tree at all, hence
the change on this end.

This is intended to only fix address the fallout from #478109,
`nixosTests.parsedmarc` fails due to some postfix module changes to
evaluate and the test of `peering-manasger` still seems broken.

[1] https://github.com/NixOS/nixpkgs/pull/478109
2026-03-21 16:00:57 +01:00

29 lines
837 B
Nix

{ lib, ... }:
{
name = "munge";
meta.maintainers = with lib.maintainers; [ h7x4 ];
nodes.machine =
{ pkgs, ... }:
{
imports = [ ./common/user-account.nix ];
services.munge.enable = true;
};
testScript =
{ nodes, ... }:
let
aliceUid = toString nodes.machine.users.users.alice.uid;
in
''
machine.succeed("mkdir -p /etc/munge && echo '${lib.strings.replicate 5 "hunter2"}' > /etc/munge/munge.key && chown munge: /etc/munge/munge.key")
machine.systemctl("restart munged.service")
machine.wait_for_unit("munged.service")
machine.succeed("sudo -u bob -- munge -u ${aliceUid} -s 'top secret' -o ./secret.txt")
machine.succeed("grep -v 'top secret' ./secret.txt")
machine.succeed("sudo -u alice unmunge -i ./secret.txt | grep 'top secret'")
'';
}