File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
src/test/java/com/rabbitmq/client/amqp/impl Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public class RecoveryClusterTest {
46
46
static final BackOffDelayPolicy BACK_OFF_DELAY_POLICY = BackOffDelayPolicy .fixed (ofSeconds (1 ));
47
47
static List <String > nodes ;
48
48
Environment environment ;
49
- Connection connection ;
49
+ AmqpConnection connection ;
50
50
Management management ;
51
51
TestInfo testInfo ;
52
52
@@ -60,12 +60,13 @@ void init(TestInfo info) {
60
60
environment =
61
61
new AmqpEnvironmentBuilder ().connectionSettings ().uris (URIS ).environmentBuilder ().build ();
62
62
this .connection =
63
- environment
64
- .connectionBuilder ()
65
- .recovery ()
66
- .backOffDelayPolicy (BACK_OFF_DELAY_POLICY )
67
- .connectionBuilder ()
68
- .build ();
63
+ (AmqpConnection )
64
+ environment
65
+ .connectionBuilder ()
66
+ .recovery ()
67
+ .backOffDelayPolicy (BACK_OFF_DELAY_POLICY )
68
+ .connectionBuilder ()
69
+ .build ();
69
70
this .management = connection .management ();
70
71
this .testInfo = info ;
71
72
}
@@ -112,9 +113,12 @@ void clusterRestart() {
112
113
nodes .forEach (Cli ::restartNode );
113
114
Cli .rebalance ();
114
115
116
+ waitAtMost (() -> connection .state () == Resource .State .OPEN );
117
+
115
118
qqNames .stream ()
116
119
.parallel ()
117
- .forEach (n -> waitAtMostNoException (() -> management .queueInfo (n )));
120
+ .forEach (
121
+ n -> waitAtMostNoException (TIMEOUT .multipliedBy (2 ), () -> management .queueInfo (n )));
118
122
qqNames .stream ()
119
123
.parallel ()
120
124
.forEach (
Original file line number Diff line number Diff line change @@ -91,8 +91,12 @@ interface RunnableWithException {
91
91
}
92
92
93
93
public static Duration waitAtMostNoException (RunnableWithException condition ) {
94
+ return waitAtMostNoException (DEFAULT_CONDITION_TIMEOUT , condition );
95
+ }
96
+
97
+ public static Duration waitAtMostNoException (Duration timeout , RunnableWithException condition ) {
94
98
return waitAtMost (
95
- DEFAULT_CONDITION_TIMEOUT ,
99
+ timeout ,
96
100
() -> {
97
101
try {
98
102
condition .run ();
You can’t perform that action at this time.
0 commit comments