You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by cs...@apache.org on 2017/08/03 14:35:23 UTC
[11/15] karaf git commit: [KARAF-5286] Make ssh tests wait for server
[KARAF-5286] Make ssh tests wait for server
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/648037a5
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/648037a5
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/648037a5
Branch: refs/heads/OPENSSH
Commit: 648037a50b0b32b8c53f0af8502b0fc85e08fb55
Parents: b403db3
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Thu Aug 3 13:01:47 2017 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Thu Aug 3 15:53:23 2017 +0200
----------------------------------------------------------------------
.../org/apache/karaf/itests/ssh/SshCommandTestBase.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/648037a5/itests/src/test/java/org/apache/karaf/itests/ssh/SshCommandTestBase.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/karaf/itests/ssh/SshCommandTestBase.java b/itests/src/test/java/org/apache/karaf/itests/ssh/SshCommandTestBase.java
index af1dbae..2b4f8cb 100644
--- a/itests/src/test/java/org/apache/karaf/itests/ssh/SshCommandTestBase.java
+++ b/itests/src/test/java/org/apache/karaf/itests/ssh/SshCommandTestBase.java
@@ -31,6 +31,7 @@ import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.session.ClientSession;
import org.apache.sshd.client.session.ClientSession.ClientSessionEvent;
+import org.awaitility.Awaitility;
import org.junit.After;
import org.junit.Before;
import org.junit.Assert;
@@ -123,9 +124,12 @@ public class SshCommandTestBase extends KarafTestSupport {
client = SshClient.setUpDefaultClient();
client.start();
String sshPort = getSshPort();
- ConnectFuture future = client.connect(username, "localhost", Integer.parseInt(sshPort));
- future.await();
- session = future.getSession();
+ Awaitility.await().ignoreExceptions().until(() -> {
+ ConnectFuture future = client.connect(username, "localhost", Integer.parseInt(sshPort));
+ future.await();
+ session = future.getSession();
+ return true;
+ });
Set<ClientSessionEvent> ret = EnumSet.of(ClientSessionEvent.WAIT_AUTH);
while (ret.contains(ClientSessionEvent.WAIT_AUTH)) {