Skip to content

Commit d0e247c

Browse files
committed
test: -u
1 parent bf6c648 commit d0e247c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tests.nix

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,21 @@ pkgs.nixosTest {
316316
(echo 'Unexpected: whoami seems to work in sandbox'; false)
317317
"""))
318318
319+
with subtest("-u exposes username in sandbox, whoami does work"):
320+
machine.succeed(as_alice("""
321+
# ensure `whoami` works outside sandbox
322+
whoami | grep 'alice' ||
323+
(echo 'Unexpected: whoami does not work outside sandbox'; false)
324+
325+
# ensure `whoami` does work in sandbox
326+
wrap -u whoami ||
327+
(echo 'Unexpected: whoami does not work in sandbox'; false)
328+
329+
wrap -u whoami | grep "^alice$" ||
330+
(echo 'Unexpected: whoami does not return username in sandbox'; false)
331+
"""))
332+
319333
320-
# with subtest("u-exposes-user-name"):
321-
# print(machine.succeed(as_alice("""
322-
# wrap -u whoami
323-
# """)))
324-
#
325334
# with subtest("env-wayland-display-is-hidden"):
326335
# print(machine.succeed(as_alice("""
327336
# WAYLAND_DISPLAY=wl-0 wrap bash -c 'set -u; echo $WAYLAND_DISPLAY' 2> error-msg || true

0 commit comments

Comments
 (0)