summary refs log tree commit diff
path: root/nixos/tests/sudo.nix
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2022-01-03 00:37:26 +0100
committerPierre Bourdon <delroth@gmail.com>2022-01-03 00:37:26 +0100
commitac96423f53d0f3277e7ae370b436122151458f6b (patch)
treef3504fed1b32bfc2127356e4e8f835862deabe52 /nixos/tests/sudo.nix
parent18c2b5d39c1f3d775497e0e808642efa523aaa7e (diff)
downloadnixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.tar
nixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.tar.gz
nixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.tar.bz2
nixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.tar.lz
nixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.tar.xz
nixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.tar.zst
nixpkgs-ac96423f53d0f3277e7ae370b436122151458f6b.zip
nixosTests.sudo: fix test flakiness
One of the subtests in the sudo NixOS test suite was broken: instead of
running the sudo invocation as user 'test2', it was running it as root.
Since root doesn't require a password to use sudo, this was causing
random "broken pipe" errors when trying to pass it a password via stdin.
Diffstat (limited to 'nixos/tests/sudo.nix')
-rw-r--r--nixos/tests/sudo.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/tests/sudo.nix b/nixos/tests/sudo.nix
index 4885d6e17b8..ae9362ca70d 100644
--- a/nixos/tests/sudo.nix
+++ b/nixos/tests/sudo.nix
@@ -73,7 +73,7 @@ in
             machine.fail('su - test1 -c "sudo -n -u root true"')
 
         with subtest("users in group 'foobar' should be able to use sudo with password"):
-            machine.succeed("sudo -u test2 echo ${password} | sudo -S -u root true")
+            machine.succeed('su - test2 -c "echo ${password} | sudo -S -u root true"')
 
         with subtest("users in group 'barfoo' should be able to use sudo without password"):
             machine.succeed("sudo -u test3 sudo -n -u root true")