geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [geode] branch develop updated: GEODE-5327: Update expected number of gateway senders (#2060)
Date Sat, 16 Jun 2018 04:39:11 GMT
This is an automated email from the ASF dual-hosted git repository.

jbarrett 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 c58acb1  GEODE-5327: Update expected number of gateway senders (#2060)
c58acb1 is described below

commit c58acb1c87766ba5f4cfb83fa2d3073e594eaebc
Author: Helena Bales <hbales@pivotal.io>
AuthorDate: Fri Jun 15 21:38:36 2018 -0700

    GEODE-5327: Update expected number of gateway senders (#2060)
    
    CreateRegionCommandDUnit test contained a race condition that caused a
    test to fail if the GatewaySenders were created faster than the 100ms
    poll rate of Awaitility. We actually expect two GatewaySenders, one for
    each server in the cluster.
    
    The wait was updated to use an assertion for better error messages when
    the test fails.
    
    Co-Authored-by: Bradford D. Boyle <bboyle@pivotal.io>
---
 .../org/apache/geode/test/junit/rules/GfshCommandRule.java  | 13 ++++++-------
 .../apache/geode/test/junit/rules/MemberStarterRule.java    |  5 ++++-
 .../internal/cli/commands/CreateRegionCommandDUnitTest.java |  2 +-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
index 71fd317..fb249df 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
@@ -82,13 +82,7 @@ public class GfshCommandRule extends DescribedExternalResource {
   private File workingDir;
   private CommandResult commandResult;
 
-  public GfshCommandRule() {
-    try {
-      temporaryFolder.create();
-    } catch (IOException e) {
-      throw new UncheckedIOException(e);
-    }
-  }
+  public GfshCommandRule() {}
 
   public GfshCommandRule(Supplier<Integer> portSupplier, PortType portType) {
     this();
@@ -99,6 +93,11 @@ public class GfshCommandRule extends DescribedExternalResource {
   @Override
   protected void before(Description description) throws Throwable {
     LogWrapper.close();
+    try {
+      temporaryFolder.create();
+    } catch (IOException e) {
+      throw new UncheckedIOException(e);
+    }
     workingDir = temporaryFolder.newFolder("gfsh_files");
     this.gfsh = new HeadlessGfsh(getClass().getName(), gfshTimeout, workingDir.getAbsolutePath());
     ignoredException =
diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
b/geode-core/src/test/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
index bd015d2..58e5b12 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/rules/MemberStarterRule.java
@@ -26,6 +26,8 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.awaitility.Awaitility.await;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
 
 import java.io.File;
 import java.io.IOException;
@@ -272,7 +274,8 @@ public abstract class MemberStarterRule<T> extends SerializableExternalResource
   public void waitTilGatewaySendersAreReady(int expectedGatewayObjectCount) throws Exception
{
     DistributedSystemMXBean dsMXBean = getManagementService().getDistributedSystemMXBean();
     await().atMost(30, TimeUnit.SECONDS)
-        .until(() -> dsMXBean.listGatewaySenderObjectNames().length == expectedGatewayObjectCount);
+        .until(() -> assertThat(dsMXBean.listGatewaySenderObjectNames().length,
+            is(expectedGatewayObjectCount)));
   }
 
   public void waitTillDiskStoreIsReady(String diskstoreName, int serverCount) {
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
b/geode-wan/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
index 828eb84..fb9b903 100644
--- a/geode-wan/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
@@ -86,7 +86,7 @@ public class CreateRegionCommandDUnitTest {
         "create gateway-sender --parallel=true --remote-distributed-system-id=2 --id="
             + gatewaySenderName)
         .statusIsSuccess();
-    locator.waitTilGatewaySendersAreReady(1);
+    locator.waitTilGatewaySendersAreReady(2);
 
     gfsh.executeAndAssertThat("create region --type=REPLICATE  --name=" + regionName
         + " --gateway-sender-id=" + gatewaySenderName)

-- 
To stop receiving notification emails like this one, please contact
jbarrett@apache.org.

Mime
View raw message