14
14
package com .rabbitmq .stream .impl ;
15
15
16
16
import static com .rabbitmq .stream .impl .TestUtils .streamName ;
17
+ import static com .rabbitmq .stream .impl .TestUtils .waitAtMost ;
17
18
import static java .util .Arrays .asList ;
18
19
import static org .assertj .core .api .Assertions .assertThat ;
19
20
24
25
import java .net .InetAddress ;
25
26
import java .net .UnknownHostException ;
26
27
import java .util .*;
28
+ import java .util .function .BooleanSupplier ;
27
29
import java .util .stream .Collectors ;
28
30
import java .util .stream .IntStream ;
31
+ import org .junit .jupiter .api .Disabled ;
29
32
import org .junit .jupiter .api .Test ;
30
33
import org .junit .jupiter .api .TestInfo ;
31
34
import org .junit .jupiter .api .extension .ExtendWith ;
@@ -38,6 +41,8 @@ public class MetadataTest {
38
41
39
42
TestUtils .ClientFactory cf ;
40
43
44
+ String stream ;
45
+
41
46
@ ValueSource (ints = {1 , 2 , 3 , 4 , 5 })
42
47
@ ParameterizedTest
43
48
void metadataExistingStreams (int streamCount , TestInfo info ) {
@@ -152,4 +157,17 @@ static String hostname() {
152
157
}
153
158
}
154
159
}
160
+
161
+ // TODO enable this test when the server fix is available
162
+ @ Test
163
+ @ Disabled
164
+ void shouldFilterOutNodesInMaintenance () throws Exception {
165
+ Client client = cf .get ();
166
+ BooleanSupplier hasLeader = () -> client .metadata (stream ).get (stream ).getLeader () != null ;
167
+ waitAtMost (() -> hasLeader .getAsBoolean ());
168
+ Host .rabbitmqctl ("eval 'rabbit_maintenance:drain().'" );
169
+ waitAtMost (() -> !hasLeader .getAsBoolean ());
170
+ Host .rabbitmqctl ("eval 'rabbit_maintenance:revive().'" );
171
+ waitAtMost (() -> hasLeader .getAsBoolean ());
172
+ }
155
173
}
0 commit comments