From b858edcfa32054e110d2685c093b36e8bb91baff Mon Sep 17 00:00:00 2001 From: jvarenina Date: Mon, 19 Sep 2022 15:48:05 +0200 Subject: [PATCH] Fix for the timeout --- .../WanCopyRegionCommandDistributedTest.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java b/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java index 759a919d40c4..da55cedc42f5 100644 --- a/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java +++ b/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java @@ -34,11 +34,13 @@ import static org.apache.geode.test.awaitility.GeodeAwaitility.await; import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import java.text.NumberFormat; import java.text.ParseException; import java.util.Arrays; import java.util.Collections; +import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Properties; @@ -73,6 +75,7 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder; import org.apache.geode.management.internal.i18n.CliStrings; import org.apache.geode.test.dunit.AsyncInvocation; +import org.apache.geode.test.dunit.IgnoredException; import org.apache.geode.test.dunit.VM; import org.apache.geode.test.dunit.rules.DistributedErrorCollector; import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; @@ -1166,12 +1169,28 @@ private int create2WanSitesAndClient(VM locatorInA, List serversInA, String private void createSender(boolean isParallelGatewaySender, List servers, String senderId, int remoteDsId) { - for (VM server : servers) { - server.invoke(() -> createSender(senderId, remoteDsId, isParallelGatewaySender, - 100, 10, false, - false, null, true)); + List> tasks = new LinkedList<>(); + for (VM vm : servers) { + tasks.add(vm.invokeAsync( + () -> vm.invoke(() -> { + IgnoredException ignoreInterruptedException = + addIgnoredException(InterruptedException.class.getName()); + try { + createSender(senderId, remoteDsId, isParallelGatewaySender, + 100, 10, false, + false, null, false); + } finally { + ignoreInterruptedException.remove(); + } + }))); + } + for (AsyncInvocation invocation : tasks) { + try { + invocation.await(); + } catch (InterruptedException e) { + fail("Creating and starting senders was interrupted"); + } } - startSenderInVMsAsync(senderId, servers.toArray(new VM[0])); } private void createReceivers(List serversInB, VM serverInC) {