geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject geode git commit: GEODE-3251: make JMX test rules more robust [Forced Update!]
Date Wed, 19 Jul 2017 18:25:19 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-3251 1e278b982 -> 1544af1f5 (forced update)


GEODE-3251: make JMX test rules more robust

Add "Failed to retrieve RMIServer stub" to rule await
to help ensure that JMX RMI is ready before running
the test.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/1544af1f
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/1544af1f
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/1544af1f

Branch: refs/heads/feature/GEODE-3251
Commit: 1544af1f5b6d84695a577eee0fb1b3270fe45ec2
Parents: c5e7779
Author: Kirk Lund <klund@apache.org>
Authored: Wed Jul 19 10:09:51 2017 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Wed Jul 19 11:25:11 2017 -0700

----------------------------------------------------------------------
 .../DiskStoreMXBeanSecurityJUnitTest.java       | 25 +++++++++-----------
 .../dunit/rules/GfshShellConnectionRule.java    |  5 ++--
 .../dunit/rules/MBeanServerConnectionRule.java  |  3 ++-
 3 files changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/1544af1f/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
index 4d101e7..bc81e16 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/DiskStoreMXBeanSecurityJUnitTest.java
@@ -17,7 +17,6 @@ package org.apache.geode.management.internal.security;
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.assertj.core.api.SoftAssertions;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
@@ -35,6 +34,7 @@ import org.apache.geode.test.junit.categories.SecurityTest;
 
 @Category({IntegrationTest.class, SecurityTest.class})
 public class DiskStoreMXBeanSecurityJUnitTest {
+
   private DiskStoreMXBean bean;
 
   @ClassRule
@@ -114,28 +114,25 @@ public class DiskStoreMXBeanSecurityJUnitTest {
   @Test
   @ConnectionConfiguration(user = "noAccess", password = "noAccess")
   public void testNoAccess() throws Exception {
-    SoftAssertions softly = new SoftAssertions();
-
-    softly.assertThatThrownBy(() -> bean.flush())
+    assertThatThrownBy(() -> bean.flush())
         .hasMessageContaining(TestCommand.clusterManageDisk.toString());
-    softly.assertThatThrownBy(() -> bean.forceCompaction())
+    assertThatThrownBy(() -> bean.forceCompaction())
         .hasMessageContaining(TestCommand.clusterManageDisk.toString());
-    softly.assertThatThrownBy(() -> bean.forceRoll())
+    assertThatThrownBy(() -> bean.forceRoll())
         .hasMessageContaining(TestCommand.clusterManageDisk.toString());
-    softly.assertThatThrownBy(() -> bean.getCompactionThreshold())
+    assertThatThrownBy(() -> bean.getCompactionThreshold())
         .hasMessageContaining(TestCommand.clusterRead.toString());
-    softly.assertThatThrownBy(() -> bean.getDiskDirectories())
+    assertThatThrownBy(() -> bean.getDiskDirectories())
         .hasMessageContaining(TestCommand.clusterRead.toString());
-    softly.assertThatThrownBy(() -> bean.getDiskReadsRate())
+    assertThatThrownBy(() -> bean.getDiskReadsRate())
         .hasMessageContaining(TestCommand.clusterRead.toString());
-    softly.assertThatThrownBy(() -> bean.isAutoCompact())
+    assertThatThrownBy(() -> bean.isAutoCompact())
         .hasMessageContaining(TestCommand.clusterRead.toString());
-    softly.assertThatThrownBy(() -> bean.isForceCompactionAllowed())
+    assertThatThrownBy(() -> bean.isForceCompactionAllowed())
         .hasMessageContaining(TestCommand.clusterRead.toString());
-    softly.assertThatThrownBy(() -> bean.setDiskUsageCriticalPercentage(0.5f))
+    assertThatThrownBy(() -> bean.setDiskUsageCriticalPercentage(0.5f))
         .hasMessageContaining(TestCommand.clusterManageDisk.toString());
-    softly.assertThatThrownBy(() -> bean.setDiskUsageWarningPercentage(0.5f))
+    assertThatThrownBy(() -> bean.setDiskUsageWarningPercentage(0.5f))
         .hasMessageContaining(TestCommand.clusterManageDisk.toString());
-    softly.assertAll();
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/1544af1f/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 872553e..100c753 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -161,10 +161,11 @@ public class GfshShellConnectionRule extends DescribedExternalResource
{
     CommandResult result = null;
     for (int i = 0; i < 50; i++) {
       result = executeCommand(connectCommand.toString());
-      if (!gfsh.outputString.contains("no such object in table")) {
+      if (!gfsh.outputString.contains("no such object in table")
+          && !gfsh.outputString.contains("Failed to retrieve RMIServer stub")) {
         break;
       }
-      Thread.currentThread().sleep(2000);
+      Thread.sleep(2000);
     }
     connected = (result.getStatus() == Result.Status.OK);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/1544af1f/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
index 3addc4e..9116af5 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/MBeanServerConnectionRule.java
@@ -165,7 +165,8 @@ public class MBeanServerConnectionRule extends DescribedExternalResource
{
       try {
         jmxConnector = JMXConnectorFactory.connect(url, env);
       } catch (Exception e) {
-        if (e.getMessage().contains("no such object in table")) {
+        if (e.getMessage().contains("no such object in table")
+            || e.getMessage().contains("Failed to retrieve RMIServer stub")) {
           // keep waiting
           return false;
         }


Mime
View raw message