geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [geode] branch develop updated: GEODE-3755: make resilient to variable number of dunit VMs
Date Fri, 06 Oct 2017 16:22:38 GMT
This is an automated email from the ASF dual-hosted git repository.

klund 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 0d5baab  GEODE-3755: make resilient to variable number of dunit VMs
0d5baab is described below

commit 0d5baab03c0adcb0e7f24fafbf03d29847aaa22c
Author: Kirk Lund <klund@apache.org>
AuthorDate: Thu Oct 5 10:43:16 2017 -0700

    GEODE-3755: make resilient to variable number of dunit VMs
    
    * use getVMCount instead of 4
---
 .../apache/geode/test/dunit/examples/BeforeClassExampleTest.java | 2 +-
 .../geode/test/dunit/examples/LocatorPortClusterExampleTest.java | 9 +++++----
 .../geode/test/dunit/rules/tests/DistributedTestRuleTest.java    | 2 +-
 .../geode/test/dunit/rules/tests/SharedCountersRuleTest.java     | 6 +++++-
 .../geode/test/dunit/rules/tests/SharedErrorCollectorTest.java   | 9 ++++-----
 5 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/examples/BeforeClassExampleTest.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/examples/BeforeClassExampleTest.java
index fa9bb11..4c3d500 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/examples/BeforeClassExampleTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/examples/BeforeClassExampleTest.java
@@ -34,6 +34,6 @@ public class BeforeClassExampleTest {
 
   @Test
   public void shouldHaveFourDUnitVMsByDefault() throws Exception {
-    assertThat(Host.getHost(0).getVMCount()).isEqualTo(4);
+    assertThat(Host.getHost(0).getVMCount()).isGreaterThan(0);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/examples/LocatorPortClusterExampleTest.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/examples/LocatorPortClusterExampleTest.java
index c87ec9f..40e4a49 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/examples/LocatorPortClusterExampleTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/examples/LocatorPortClusterExampleTest.java
@@ -65,9 +65,10 @@ public class LocatorPortClusterExampleTest implements Serializable {
   }
 
   @Test
-  public void clusterHasSixVMsByDefault() throws Exception {
-    assertThat(cache.getDistributionManager().getViewMembers()).hasSize(6);
-    assertThat(Host.getHost(0).getVMCount()).isEqualTo(4);
-    assertThat(Host.getHost(0).getAllVMs()).hasSize(4);
+  public void clusterHasDUnitVMCountPlusTwoByDefault() throws Exception {
+    int dunitVMCount = Host.getHost(0).getVMCount();
+    assertThat(cache.getDistributionManager().getViewMembers()).hasSize(dunitVMCount + 2);
+    assertThat(Host.getHost(0).getVMCount()).isEqualTo(dunitVMCount);
+    assertThat(Host.getHost(0).getAllVMs()).hasSize(dunitVMCount);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/DistributedTestRuleTest.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/DistributedTestRuleTest.java
index c2c0cc8..b6e0fe9 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/DistributedTestRuleTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/DistributedTestRuleTest.java
@@ -32,6 +32,6 @@ public class DistributedTestRuleTest {
 
   @Test
   public void shouldHaveFourDUnitVMsByDefault() throws Exception {
-    assertThat(Host.getHost(0).getVMCount()).isEqualTo(4);
+    assertThat(Host.getHost(0).getVMCount()).isGreaterThan(0);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedCountersRuleTest.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedCountersRuleTest.java
index 7b1290e..9508a66 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedCountersRuleTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedCountersRuleTest.java
@@ -143,7 +143,11 @@ public class SharedCountersRuleTest implements Serializable {
       vm.invoke(() -> combined.get(timeoutMillis, MILLISECONDS));
     }
 
-    assertThat(sharedCountersRule.getTotal(ID1)).isEqualTo(50);
+    int dunitVMCount = Host.getHost(0).getVMCount();
+    int controllerPlusDUnitVMCount = dunitVMCount + 1;
+    int expectedIncrements = controllerPlusDUnitVMCount * numThreads;
+
+    assertThat(sharedCountersRule.getTotal(ID1)).isEqualTo(expectedIncrements);
   }
 
   private void givenSharedCounterFor(final Serializable id) {
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedErrorCollectorTest.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedErrorCollectorTest.java
index 2063025..82283c8 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedErrorCollectorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/tests/SharedErrorCollectorTest.java
@@ -30,7 +30,6 @@ import org.junit.runner.Result;
 import org.junit.runner.notification.Failure;
 
 import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.RMIException;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.rules.DistributedTestRule;
 import org.apache.geode.test.dunit.rules.SharedErrorCollector;
@@ -91,7 +90,7 @@ public class SharedErrorCollectorTest {
 
     assertThat(result.wasSuccessful()).isFalse();
     List<Failure> failures = result.getFailures();
-    assertThat(failures).hasSize(4);
+    assertThat(failures).hasSize(Host.getHost(0).getVMCount());
     int i = 0;
     for (Failure failure : failures) {
       assertThat(failure.getException()).isInstanceOf(AssertionError.class)
@@ -105,7 +104,7 @@ public class SharedErrorCollectorTest {
 
     assertThat(result.wasSuccessful()).isFalse();
     List<Failure> failures = result.getFailures();
-    assertThat(failures).hasSize(5);
+    assertThat(failures).hasSize(Host.getHost(0).getVMCount() + 1);
     boolean first = true;
     int i = 0;
     for (Failure failure : failures) {
@@ -148,7 +147,7 @@ public class SharedErrorCollectorTest {
 
     assertThat(result.wasSuccessful()).isFalse();
     List<Failure> failures = result.getFailures();
-    assertThat(failures).hasSize(4);
+    assertThat(failures).hasSize(Host.getHost(0).getVMCount());
     int i = 0;
     for (Failure failure : failures) {
       assertThat(failure.getException()).isInstanceOf(NullPointerException.class)
@@ -162,7 +161,7 @@ public class SharedErrorCollectorTest {
 
     assertThat(result.wasSuccessful()).isFalse();
     List<Failure> failures = result.getFailures();
-    assertThat(failures).hasSize(5);
+    assertThat(failures).hasSize(Host.getHost(0).getVMCount() + 1);
     boolean first = true;
     int i = 0;
     for (Failure failure : failures) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message