Skip to content

Commit b7d3b0b

Browse files
committed
Test nodes in maintenance are filtered out from metadata
Test is disabled for now.
1 parent 734c4ec commit b7d3b0b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/java/com/rabbitmq/stream/impl/MetadataTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package com.rabbitmq.stream.impl;
1515

1616
import static com.rabbitmq.stream.impl.TestUtils.streamName;
17+
import static com.rabbitmq.stream.impl.TestUtils.waitAtMost;
1718
import static java.util.Arrays.asList;
1819
import static org.assertj.core.api.Assertions.assertThat;
1920

@@ -24,8 +25,10 @@
2425
import java.net.InetAddress;
2526
import java.net.UnknownHostException;
2627
import java.util.*;
28+
import java.util.function.BooleanSupplier;
2729
import java.util.stream.Collectors;
2830
import java.util.stream.IntStream;
31+
import org.junit.jupiter.api.Disabled;
2932
import org.junit.jupiter.api.Test;
3033
import org.junit.jupiter.api.TestInfo;
3134
import org.junit.jupiter.api.extension.ExtendWith;
@@ -38,6 +41,8 @@ public class MetadataTest {
3841

3942
TestUtils.ClientFactory cf;
4043

44+
String stream;
45+
4146
@ValueSource(ints = {1, 2, 3, 4, 5})
4247
@ParameterizedTest
4348
void metadataExistingStreams(int streamCount, TestInfo info) {
@@ -152,4 +157,17 @@ static String hostname() {
152157
}
153158
}
154159
}
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+
}
155173
}

0 commit comments

Comments
 (0)