szetszwo commented on a change in pull request #310:
URL: https://github.com/apache/incubator-ratis/pull/310#discussion_r533848011
##########
File path:
ratis-test/src/test/java/org/apache/ratis/datastream/DataStreamAsyncClusterTests.java
##########
@@ -69,12 +69,29 @@ public void testMultipleStreamsMultipleServers() throws
Exception {
RaftServerConfigKeys.Rpc.setTimeoutMax(getProperties(), max);
}
+ @Test
+ public void testSingleStreamMultipleServersStepDownLeader() throws Exception
{
+ runWithNewCluster(3, this::runTestDataStreamStepDownLeader);
+ }
+
+ void runTestDataStreamStepDownLeader(CLUSTER cluster) throws Exception {
+ runTestDataStream(cluster, true);
+ }
+
void runTestDataStream(CLUSTER cluster) throws Exception {
+ runTestDataStream(cluster, false);
+ }
+
+ void runTestDataStream(CLUSTER cluster, boolean stepDownLeader) throws
Exception {
RaftTestUtil.waitForLeader(cluster);
final List<CompletableFuture<Long>> futures = new ArrayList<>();
- futures.add(CompletableFuture.supplyAsync(() -> runTestDataStream(cluster,
5, 10, 1_000_000, 10), executor));
- futures.add(CompletableFuture.supplyAsync(() -> runTestDataStream(cluster,
2, 20, 1_000, 10_000), executor));
+ if (stepDownLeader) {
+ futures.add(CompletableFuture.supplyAsync(() ->
runTestDataStream(cluster, 1, 1, 1_000_000, 10, stepDownLeader), executor));
Review comment:
Tried to run with more streams but the test may fail once in a while.
```
@@ -87,7 +87,7 @@ public abstract class DataStreamAsyncClusterTests<CLUSTER
extends MiniRaftCluste
final List<CompletableFuture<Long>> futures = new ArrayList<>();
if (stepDownLeader) {
- futures.add(CompletableFuture.supplyAsync(() ->
runTestDataStream(cluster, 1, 1, 1_000_000, 10, stepDownLeader), executor));
+ futures.add(CompletableFuture.supplyAsync(() ->
runTestDataStream(cluster, 2, 10, 1_000, 10_000, stepDownLeader), executor));
} else {
futures.add(CompletableFuture.supplyAsync(() ->
runTestDataStream(cluster, 5, 10, 1_000_000, 10, stepDownLeader), executor));
futures.add(CompletableFuture.supplyAsync(() ->
runTestDataStream(cluster, 2, 20, 1_000, 10_000, stepDownLeader), executor));
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]