Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit 10fd2d5

Browse files
committed
fix
1 parent 2649009 commit 10fd2d5

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

test/src/test/java/de/widdix/awsec2ssh/ATest.java

+7-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
public abstract class ATest {
1818

19-
protected final <T> T retry(final Context context, final Callable<T> callable) {
19+
protected final <T> T retry(final Callable<T> callable) {
2020
final AtomicInteger t = new AtomicInteger(0);
2121
final Callable<T> wrapper = () -> {
2222
try {
@@ -34,13 +34,8 @@ protected final <T> T retry(final Context context, final Callable<T> callable) {
3434
.withDelayBetweenTries(10, ChronoUnit.SECONDS)
3535
.withFixedBackoff()
3636
.build();
37-
try {
38-
final CallResults<Object> results = new CallExecutor(config).execute(wrapper);
39-
return (T) results.getResult();
40-
} catch (final RuntimeException e) {
41-
context.reportFailure();
42-
throw e;
43-
}
37+
final CallResults<Object> results = new CallExecutor(config).execute(wrapper);
38+
return (T) results.getResult();
4439
}
4540

4641
public static final class User {
@@ -56,7 +51,7 @@ public User(final String userName, final byte[] sshPrivateKeyBlob, final String
5651
}
5752
}
5853

59-
protected final void probeSSH(final Context context, final String host, final User user) {
54+
protected final void probeSSH(final String host, final User user) {
6055
final Callable<Boolean> callable = () -> {
6156
final JSch jsch = new JSch();
6257
final Session session = jsch.getSession(user.userName, host);
@@ -66,10 +61,10 @@ protected final void probeSSH(final Context context, final String host, final Us
6661
session.disconnect();
6762
return true;
6863
};
69-
Assert.assertTrue("successful SSH connection", this.retry(context, callable));
64+
Assert.assertTrue("successful SSH connection", this.retry(callable));
7065
}
7166

72-
protected final void probeSSH(final Context context, final String host, final KeyPair key) {
67+
protected final void probeSSH(final String host, final KeyPair key) {
7368
final Callable<Boolean> callable = () -> {
7469
final JSch jsch = new JSch();
7570
final Session session = jsch.getSession("ec2-user", host);
@@ -79,7 +74,7 @@ protected final void probeSSH(final Context context, final String host, final Ke
7974
session.disconnect();
8075
return true;
8176
};
82-
Assert.assertTrue("successful SSH connection", this.retry(context, callable));
77+
Assert.assertTrue("successful SSH connection", this.retry(callable));
8378
}
8479

8580
protected final Session tunnelSSH(final String host, final KeyPair key, final Integer localPort, final String remoteHost, final Integer remotePort) throws JSchException {

0 commit comments

Comments
 (0)