This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 8b011abe7d09 CAMEL-25343: Fix flaky test
SshIdleTimeoutTest.testIdleTimeoutExpiresBeforeCommandCompletes (#27498)
8b011abe7d09 is described below
commit 8b011abe7d092df348356b818ad65738575606fb
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Oct 7 14:59:28 2026 +0200
CAMEL-25343: Fix flaky test
SshIdleTimeoutTest.testIdleTimeoutExpiresBeforeCommandCompletes (#27498)
The test had a 2:1 timing ratio (1000ms command delay vs 500ms idle
timeout) that was too narrow under CI load. MINA SSHD's idle timeout is checked
periodically by the I/O loop and only starts after handshake and channel open,
so jitter could let the command finish first.
Increase the DelayedEchoCommandFactory delay to 5000ms (10:1 ratio), align
the long-idle-timeout test routes (timeout=30000, idleTimeout=30000) and fix
stale comments.
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../org/apache/camel/component/ssh/SshIdleTimeoutTest.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
index 28591519dc3e..0602864f5162 100644
---
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
+++
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshIdleTimeoutTest.java
@@ -112,7 +112,7 @@ public class SshIdleTimeoutTest extends
SshComponentTestSupport {
delayedSshd = SshServer.setUpDefaultServer();
delayedSshd.setPort(0);
delayedSshd.setKeyPairProvider(new
FileKeyPairProvider(Paths.get("src/test/resources/hostkey.pem")));
- delayedSshd.setCommandFactory(new DelayedEchoCommandFactory(1000));
+ delayedSshd.setCommandFactory(new DelayedEchoCommandFactory(5000));
delayedSshd.setPasswordAuthenticator((username, password, session) ->
true);
delayedSshd.setPublickeyAuthenticator((username, key, session) ->
true);
delayedSshd.start();
@@ -122,8 +122,10 @@ public class SshIdleTimeoutTest extends
SshComponentTestSupport {
@Test
public void testIdleTimeoutExpiresBeforeCommandCompletes() throws
Exception {
// Send the command using a producer with idleTimeout=500ms.
- // The client's idle timeout fires during the 3s command delay,
+ // The client's idle timeout fires during the 5s command delay,
// closing the session before the command completes.
+ // The 10:1 ratio (500ms timeout vs 5000ms delay) provides a wide
margin
+ // against scheduling jitter in CI environments (-T1C parallel builds).
Exchange exchange = template.send(
"direct:sshWithShortIdleTimeout",
e -> e.getIn().setBody("test"));
@@ -136,8 +138,8 @@ public class SshIdleTimeoutTest extends
SshComponentTestSupport {
@Test
public void testIdleTimeoutLongerThanCommandDelay() throws Exception {
- // Send the command using a producer with idleTimeout=5000ms.
- // The command delay (3s) completes before the idle timeout fires.
+ // Send the command using a producer with idleTimeout=30000ms.
+ // The command delay (5s) completes before the idle timeout fires.
Exchange exchange = template.send(
"direct:sshWithLongIdleTimeout",
e -> e.getIn().setBody("test"));
@@ -157,9 +159,9 @@ public class SshIdleTimeoutTest extends
SshComponentTestSupport {
.to("mock:result");
from("direct:sshWithShortIdleTimeout")
- .to("ssh://smx:smx@localhost:" + delayedPort +
"?timeout=5000&idleTimeout=500");
+ .to("ssh://smx:smx@localhost:" + delayedPort +
"?timeout=10000&idleTimeout=500");
from("direct:sshWithLongIdleTimeout")
- .to("ssh://smx:smx@localhost:" + delayedPort +
"?timeout=5000&idleTimeout=5000");
+ .to("ssh://smx:smx@localhost:" + delayedPort +
"?timeout=30000&idleTimeout=30000");
}
};
}