geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [geode] branch develop updated: GEODE-5212: Account for dynamic values returned from metrics MBean (#2300)
Date Fri, 10 Aug 2018 19:17:22 GMT
This is an automated email from the ASF dual-hosted git repository.

jensdeppe 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 914adc4  GEODE-5212: Account for dynamic values returned from metrics MBean (#2300)
914adc4 is described below

commit 914adc4aa8515e0c1506cd1c8f3d319eae9a7151
Author: Jens Deppe <jdeppe@pivotal.io>
AuthorDate: Fri Aug 10 12:17:17 2018 -0700

    GEODE-5212: Account for dynamic values returned from metrics MBean (#2300)
---
 .../distributed/LauncherMemberMXBeanIntegrationTest.java    | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LauncherMemberMXBeanIntegrationTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LauncherMemberMXBeanIntegrationTest.java
index 36574ce..b98bfd4 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/LauncherMemberMXBeanIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/LauncherMemberMXBeanIntegrationTest.java
@@ -20,6 +20,7 @@ import static javax.management.MBeanServerInvocationHandler.newProxyInstance;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.within;
 
 import java.util.Properties;
 import java.util.Set;
@@ -119,13 +120,19 @@ public class LauncherMemberMXBeanIntegrationTest extends LauncherIntegrationTest
         (CompositeDataSupport) getPlatformMBeanServer().invoke(mbeanObjectName, "showOSMetrics",
             null, null);
     OSMetrics osMetrics = mbean.showOSMetrics();
+    assertThat(osMetrics).isNotNull();
+
+    Long osMetricsCommittedMemory = osMetrics.getCommittedVirtualMemorySize();
+    float virtualMemoryRatio = osMetricsCommittedMemory.floatValue()
+        / ((Long) cds.get("committedVirtualMemorySize")).floatValue();
+
+    // On windows in particular, the memory value returned from the live bean has often already
+    // changed from the statically recorded value.
+    assertThat(virtualMemoryRatio).isCloseTo(virtualMemoryRatio, within(0.01F));
 
     // Verify conversion from CompositeData to OSMetrics
-    assertThat(osMetrics).isNotNull();
     assertThat(osMetrics.getArch()).isEqualTo(cds.get("arch"));
     assertThat(osMetrics.getAvailableProcessors()).isEqualTo(cds.get("availableProcessors"));
-    assertThat(osMetrics.getCommittedVirtualMemorySize())
-        .isEqualTo(cds.get("committedVirtualMemorySize"));
     assertThat(osMetrics.getFreePhysicalMemorySize()).isEqualTo(cds.get("freePhysicalMemorySize"));
     assertThat(osMetrics.getFreeSwapSpaceSize()).isEqualTo(cds.get("freeSwapSpaceSize"));
     assertThat(osMetrics.getMaxFileDescriptorCount()).isEqualTo(cds.get("maxFileDescriptorCount"));


Mime
View raw message