You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by he...@apache.org on 2018/12/05 00:02:44 UTC
[geode] branch develop updated: GEODE-6107: in test start locators
one at a time (#2933)
This is an automated email from the ASF dual-hosted git repository.
heybales 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 6a0e08b GEODE-6107: in test start locators one at a time (#2933)
6a0e08b is described below
commit 6a0e08b034d1b57b5e680f67c7c4bbe918a1f053
Author: Helena Bales <hb...@pivotal.io>
AuthorDate: Tue Dec 4 16:02:35 2018 -0800
GEODE-6107: in test start locators one at a time (#2933)
* GEODE-6107: in test start locators one at a time
There exists a known race condition in starting locators such that if
two locators are started simultaneously, not all the MBeans get
federated to both members. This was causing intermittent test failures
in the before() of JMXMBeanReconnectDUnitTest. To fix this, a wait has
been added so that the first member has enough time to start before the
second one.
A wait has also been added after starting locator2 so that the locator has enough time to
start before attempting to establish a JMX connection. If the locator has not fully started, connecting to the MBean server will result in an exception.
---
.../management/JMXMBeanReconnectDUnitTest.java | 3 +++
.../apache/geode/test/dunit/rules/MemberVM.java | 28 ++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
index 7ea8529..b7344ae 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/JMXMBeanReconnectDUnitTest.java
@@ -86,7 +86,10 @@ public class JMXMBeanReconnectDUnitTest {
@Before
public void before() throws Exception {
locator1 = lsRule.startLocatorVM(LOCATOR_1_VM_INDEX, locator1Properties());
+ locator1.waitTilLocatorFullyStarted();
+
locator2 = lsRule.startLocatorVM(LOCATOR_2_VM_INDEX, locator2Properties(), locator1.getPort());
+ locator2.waitTilLocatorFullyStarted();
server1 = lsRule.startServerVM(SERVER_1_VM_INDEX, locator1.getPort());
// start an extra server to have more MBeans, but we don't need to use it in these tests
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/MemberVM.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/MemberVM.java
index 15bfd73..3aedc51 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/MemberVM.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/MemberVM.java
@@ -130,6 +130,34 @@ public class MemberVM extends VMProvider implements Member {
});
}
+ public void waitTilLocatorFullyStarted() {
+ vm.invoke(() -> {
+ try {
+ await().until(() -> {
+ InternalLocator intLocator = ClusterStartupRule.getLocator();
+ InternalCache cache = ClusterStartupRule.getCache();
+ return intLocator != null && cache != null && intLocator.getDistributedSystem()
+ .isConnected();
+ });
+ } catch (Exception e) {
+ // provide more information when condition is not satisfied after awaitility timeout
+ InternalLocator intLocator = ClusterStartupRule.getLocator();
+ InternalCache cache = ClusterStartupRule.getCache();
+ DistributedSystem ds = intLocator.getDistributedSystem();
+ logger.info("locator is: " + (intLocator != null ? "not null" : "null"));
+ logger.info("cache is: " + (cache != null ? "not null" : "null"));
+ if (ds != null) {
+ logger
+ .info("distributed system is: " + (ds.isConnected() ? "connected" : "not connected"));
+ } else {
+ logger.info("distributed system is: null");
+ }
+ throw e;
+ }
+
+ });
+ }
+
public void waitTilLocatorFullyReconnected() {
vm.invoke(() -> {
try {