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:
Joachim Fasting 2016-03-25 06:28:01 +01:00
parent a096800676
commit ea443d719c

View file

@ -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'");
};
'';
})