nixos/tests: implement a trivial test for sudo
This is an alternative to NixOS/nixpkgs#6721, with improvements suggested by @edolstra
This commit is contained in:
parent
a096800676
commit
ea443d719c
|
@ -23,6 +23,8 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||
{ wantedBy = [ "multi-user.target" ];
|
||||
where = "/tmp2";
|
||||
};
|
||||
users.users.sybil = { isNormalUser = true; group = "wheel"; };
|
||||
security.sudo = { enable = true; wheelNeedsPassword = false; };
|
||||
};
|
||||
|
||||
testScript =
|
||||
|
@ -110,5 +112,10 @@ import ./make-test.nix ({ pkgs, ...} : {
|
|||
subtest "nix-db", sub {
|
||||
$machine->succeed("nix-store -qR /run/current-system | grep nixos-");
|
||||
};
|
||||
|
||||
# Test sudo
|
||||
subtest "sudo", sub {
|
||||
$machine->succeed("su - sybil -c 'sudo true'");
|
||||
};
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue