Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/ubuntu.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ in {
'';
}).sandboxed;

sudoSameConsole = (lib.ubuntu."23_04" {
sharedDirs = {};
testScript = ''
# Ensure using sudo doesn't crash the test-driver
vm.execute("sudo bash -c \"echo 'Created foo → bar.\n' >&2 && echo 'foo' \"")
'';
}).sandboxed;

}
// package.ubuntu.images
// runTestOnEveryImage multiUserTest
13 changes: 13 additions & 0 deletions ubuntu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ let
systemctl mask snapd.socket
systemctl mask snapd.seeded.service

# Disable TTY usage in sudo.
# Otherwise, using sudo spawns a new pty, causing the test-driver to
# receive mixed stdout and stderr when processing command output.
# The driver only expects base64-encoded stdout, so extra stderr data
# can break the output parsing.
mkdir -p /etc/sudoers.d
cat << EOF > /etc/sudoers.d/disable-pty
Defaults !requiretty
Defaults !use_pty
EOF
visudo -cf /etc/sudoers.d/disable-pty
chmod 440 /etc/sudoers.d/disable-pty

# We have no network in the test VMs, avoid an error on bootup
systemctl mask ssh.service
systemctl mask ssh.socket
Expand Down