This is an automated email from the ASF dual-hosted git repository.

alberto pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new b21c2c6  GEODE-9984: Avoid flakyness of 
testCommandDoesNotCopyEntriesUpdatedAf… (#7330)
b21c2c6 is described below

commit b21c2c6eba9e85d03ffd40d8aca566e53a5230f1
Author: Alberto Gomez <[email protected]>
AuthorDate: Sat Mar 5 22:36:19 2022 +0100

    GEODE-9984: Avoid flakyness of testCommandDoesNotCopyEntriesUpdatedAf… 
(#7330)
    
    * GEODE-9984: Avoid flakyness of distributed test
    
    A sleep has been added before starting the second group of puts
    in the testCommandDoesNotCopyEntriesUpdatedAfterCommandStarted
    test case so that we can be more certain that when
    puts start, the command has effectively started its execution.
    
    * GEODE-9984: New solution without using a sleep
---
 .../internal/cli/commands/WanCopyRegionCommandDUnitTest.java   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDUnitTest.java
 
b/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDUnitTest.java
index 84c2a00..ce6a030 100644
--- 
a/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDUnitTest.java
+++ 
b/geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDUnitTest.java
@@ -861,8 +861,11 @@ public class WanCopyRegionCommandDUnitTest extends 
WANTestBase {
     Future<CommandResultAssert> wanCopyCommandFuture =
         executorServiceRule.submit(wanCopyCommandCallable);
 
-    // Wait for the command to start
-    waitForWanCopyRegionCommandToStart(isParallelGatewaySender, 
isPartitionedRegion, serversInA);
+    // Wait for the command to have copied at least one entry.
+    // This way, the below puts will not be replicated by the command.
+    await().untilAsserted(
+        () -> assertThat(serverInB.invoke(() -> getRegionSize(regionName)))
+            .isGreaterThan(0));
 
     // While the command is running, send some random operations over a 
different set of keys
     client.invoke(() -> doPutsFrom(regionName, entries, entries + 2000));
@@ -1460,7 +1463,8 @@ public class WanCopyRegionCommandDUnitTest extends 
WANTestBase {
   }
 
   private void waitForWanCopyRegionCommandToStart(boolean useParallel, boolean 
usePartitionedRegion,
-      List<VM> servers) {
+      List<VM> servers) throws InterruptedException {
+    // Wait for the command execution to be registered in the service
     final int executionsExpected = useParallel && usePartitionedRegion ? 
servers.size() : 1;
     await().untilAsserted(
         () -> assertThat(getNumberOfCurrentExecutionsInServers(servers))

Reply via email to