16
16
17
17
public abstract class ATest {
18
18
19
- protected final <T > T retry (final Context context , final Callable <T > callable ) {
19
+ protected final <T > T retry (final Callable <T > callable ) {
20
20
final AtomicInteger t = new AtomicInteger (0 );
21
21
final Callable <T > wrapper = () -> {
22
22
try {
@@ -34,13 +34,8 @@ protected final <T> T retry(final Context context, final Callable<T> callable) {
34
34
.withDelayBetweenTries (10 , ChronoUnit .SECONDS )
35
35
.withFixedBackoff ()
36
36
.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 ();
44
39
}
45
40
46
41
public static final class User {
@@ -56,7 +51,7 @@ public User(final String userName, final byte[] sshPrivateKeyBlob, final String
56
51
}
57
52
}
58
53
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 ) {
60
55
final Callable <Boolean > callable = () -> {
61
56
final JSch jsch = new JSch ();
62
57
final Session session = jsch .getSession (user .userName , host );
@@ -66,10 +61,10 @@ protected final void probeSSH(final Context context, final String host, final Us
66
61
session .disconnect ();
67
62
return true ;
68
63
};
69
- Assert .assertTrue ("successful SSH connection" , this .retry (context , callable ));
64
+ Assert .assertTrue ("successful SSH connection" , this .retry (callable ));
70
65
}
71
66
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 ) {
73
68
final Callable <Boolean > callable = () -> {
74
69
final JSch jsch = new JSch ();
75
70
final Session session = jsch .getSession ("ec2-user" , host );
@@ -79,7 +74,7 @@ protected final void probeSSH(final Context context, final String host, final Ke
79
74
session .disconnect ();
80
75
return true ;
81
76
};
82
- Assert .assertTrue ("successful SSH connection" , this .retry (context , callable ));
77
+ Assert .assertTrue ("successful SSH connection" , this .retry (callable ));
83
78
}
84
79
85
80
protected final Session tunnelSSH (final String host , final KeyPair key , final Integer localPort , final String remoteHost , final Integer remotePort ) throws JSchException {
0 commit comments