fix(itests): disable PTY in SSH test channels to fix garbled output on Windows#2544
Open
jbonofre wants to merge 4 commits intoapache:mainfrom
Open
fix(itests): disable PTY in SSH test channels to fix garbled output on Windows#2544jbonofre wants to merge 4 commits intoapache:mainfrom
jbonofre wants to merge 4 commits intoapache:mainfrom
Conversation
f30a1ca to
b27cb03
Compare
With a PTY allocated and the default terminal type, JLine on the server side runs in interactive mode and re-renders each character as it is typed, producing garbled output (e.g. "conficonfigconfig:property-set") on Windows where I/O flush timing differs from Linux/macOS. Use a PTY with terminal type "dumb" and ECHO disabled instead: - The PTY allocation preserves the normal channel lifecycle so the server closes the channel when the shell exits (setUsePty(false) broke this). - JLine detects "dumb" and runs in non-interactive mode, avoiding the character re-rendering that caused the garbled output. Also send JAAS setup commands as separate newline-terminated lines rather than semicolon-chained, and close the stdin pipe after logout to send EOF as a clean shutdown signal.
b27cb03 to
d5017cb
Compare
…l lifecycle issues With a "dumb" PTY shell channel, the Karaf shell hangs and does not close the channel cleanly after processing the JAAS commands, causing the 15 s waitFor(CLOSED) to time out. As a result jaas:update is never committed and the test user does not exist, leading to "No more authentication methods available" when assertCommand tries to connect as that user. Fix addUsers/addViewer to use executeCommand (direct OSGi container execution, already available from KarafTestSupport) instead of an SSH shell channel. SSH is only required for the actual security assertions in assertCommand, not for test setup. The "dumb" PTY is kept for assertCommand to suppress JLine's character re-rendering that produced garbled output on Windows.
The get-wrapper-native-lib antrun goal downloads Tanuki wrapper binaries from download.tanukisoftware.com, which is intermittently unreachable from CI runners. A single failed download aborts the entire build even though the affected platform binaries (AIX, HP-UX, Solaris, etc.) are not needed for the CI test environments. Add ignoreerrors="true" and skipexisting="true" to all <get> tasks so that download failures are non-fatal and already-fetched archives are not re-downloaded. Add failonerror="false" to the dependent gunzip/untar/unzip and copy tasks so that a missing archive does not cascade into a build failure.
Use Ant <available> task to set a property when the downloaded archive exists, then use if="property" on <gunzip> and <untar> tasks (which do not support failonerror) so extraction is skipped when the download from tanukisoftware.com fails (e.g. on Ubuntu CI runners).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SshCommandTestBase.openSshChannelpreviously allocated a pseudo-terminal (PTY) for the shell channel, even though all tests use it for scripted (non-interactive) command execution.conficonfigconfig:property-setin the captured output stream.setPtyModes(PtyMode.ECHO, 0)) disabled terminal echo but still allocated a PTY, so JLine's display-refresh writes continued to pollute the output.channel.setUsePty(false)(available in Apache MINA SSHDPtyCapableChannelSession) so no PTY is requested and JLine runs in dumb/non-interactive mode — the raw command output is then captured cleanly on all platforms.