You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ji...@apache.org on 2018/07/10 21:15:20 UTC
[geode] branch develop updated: GEODE-5407: increase timeout and
provide more logging (#2120)
This is an automated email from the ASF dual-hosted git repository.
jinmeiliao 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 442e7aa GEODE-5407: increase timeout and provide more logging (#2120)
442e7aa is described below
commit 442e7aac8c4fa4ed5a91cfbe77520240321d1532
Author: jinmeiliao <ji...@pivotal.io>
AuthorDate: Tue Jul 10 14:15:15 2018 -0700
GEODE-5407: increase timeout and provide more logging (#2120)
Co-authored-by: Mark Hanson <mh...@pivotal.io>
---
.../apache/geode/test/dunit/rules/MemberVM.java | 59 ++++++++++++++++------
1 file changed, 44 insertions(+), 15 deletions(-)
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberVM.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberVM.java
index eef2990..e383be1 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberVM.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MemberVM.java
@@ -21,11 +21,13 @@ import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
+import org.apache.logging.log4j.Logger;
import org.awaitility.Awaitility;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.distributed.internal.InternalLocator;
import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
import org.apache.geode.test.dunit.VM;
import org.apache.geode.test.junit.rules.Locator;
import org.apache.geode.test.junit.rules.Member;
@@ -33,6 +35,7 @@ import org.apache.geode.test.junit.rules.Server;
import org.apache.geode.test.junit.rules.VMProvider;
public class MemberVM extends VMProvider implements Member {
+ private Logger logger = LogService.getLogger();
protected Member member;
protected VM vm;
@@ -106,27 +109,53 @@ public class MemberVM extends VMProvider implements Member {
* reconnect after 5 seconds.
*/
public void forceDisconnectMember() {
- vm.invoke(() -> ClusterStartupRule.memberStarter.forceDisconnectMember());
+ vm.invoke("force disconnect", () -> ClusterStartupRule.memberStarter.forceDisconnectMember());
}
public void waitTilLocatorFullyReconnected() {
- vm.invoke(() -> Awaitility.waitAtMost(30, TimeUnit.SECONDS).until(() -> {
- InternalLocator intLocator = InternalLocator.getLocator();
- InternalCache cache = ClusterStartupRule.getCache();
- return intLocator != null && cache != null && intLocator.getDistributedSystem().isConnected()
- && intLocator.isReconnected();
- }));
+ vm.invoke(() -> {
+ try {
+ Awaitility.waitAtMost(60, TimeUnit.SECONDS).until(() -> {
+ InternalLocator intLocator = ClusterStartupRule.getLocator();
+ InternalCache cache = ClusterStartupRule.getCache();
+ return intLocator != null && cache != null && intLocator.getDistributedSystem()
+ .isConnected() && intLocator.isReconnected();
+ });
+ } catch (Exception e) {
+ // provide more information when condition is not satisfied after one minute
+ InternalLocator intLocator = ClusterStartupRule.getLocator();
+ InternalCache cache = ClusterStartupRule.getCache();
+ logger.info("locator is not null: " + (intLocator != null));
+ logger.info("cache is not null: " + (cache != null));
+ logger.info("ds is connected: " + (intLocator.getDistributedSystem().isConnected()));
+ logger.info("locator is reconnected: " + (intLocator.isReconnected()));
+ throw e;
+ }
+
+ });
}
public void waitTilServerFullyReconnected() {
- vm.invoke(() -> Awaitility.waitAtMost(30, SECONDS).until(() -> {
- InternalDistributedSystem internalDistributedSystem =
- InternalDistributedSystem.getConnectedInstance();
- return internalDistributedSystem != null
- && internalDistributedSystem.getCache() != null
- && !internalDistributedSystem.getCache().getCacheServers().isEmpty();
- }));
-
+ vm.invoke(() -> {
+ try {
+ Awaitility.waitAtMost(60, SECONDS).until(() -> {
+ InternalDistributedSystem internalDistributedSystem =
+ InternalDistributedSystem.getConnectedInstance();
+ return internalDistributedSystem != null
+ && internalDistributedSystem.getCache() != null
+ && !internalDistributedSystem.getCache().getCacheServers().isEmpty();
+ });
+ } catch (Exception e) {
+ // provide more information when condition is not satisfied after one minute
+ InternalDistributedSystem internalDistributedSystem =
+ InternalDistributedSystem.getConnectedInstance();
+ logger.info("ds is not null: " + (internalDistributedSystem != null));
+ logger.info("cache is not null: " + (internalDistributedSystem.getCache() != null));
+ logger.info("has cache server: "
+ + (!internalDistributedSystem.getCache().getCacheServers().isEmpty()));
+ throw e;
+ }
+ });
}
/**