From 1e6b2d4f1d21442b176bff81279231316ec1ad23 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 2 Feb 2016 08:27:57 -0500 Subject: [PATCH] Fix JVM GC monitor missing settings test This commit fixes a test bug in JvmGcMonitorServiceSettingsTests#testMissingSetting. The purpose of the test is to test that if settings are provided for a collector for at least one of warn, info, and debug then it is provided for all of warn, info, and debug. However, for a collector setting to be valid it must be a positive time value but the randomization in the test construction could produce zero time values. Closes #16369 --- .../monitor/jvm/JvmGcMonitorServiceSettingsTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/monitor/jvm/JvmGcMonitorServiceSettingsTests.java b/core/src/test/java/org/elasticsearch/monitor/jvm/JvmGcMonitorServiceSettingsTests.java index 29f497458c7..2c248969b2c 100644 --- a/core/src/test/java/org/elasticsearch/monitor/jvm/JvmGcMonitorServiceSettingsTests.java +++ b/core/src/test/java/org/elasticsearch/monitor/jvm/JvmGcMonitorServiceSettingsTests.java @@ -62,9 +62,9 @@ public class JvmGcMonitorServiceSettingsTests extends ESTestCase { public void testMissingSetting() throws InterruptedException { String collector = randomAsciiOfLength(5); Set> entries = new HashSet<>(); - entries.add(new AbstractMap.SimpleEntry<>("monitor.jvm.gc.collector." + collector + ".warn", randomTimeValue())); - entries.add(new AbstractMap.SimpleEntry<>("monitor.jvm.gc.collector." + collector + ".info", randomTimeValue())); - entries.add(new AbstractMap.SimpleEntry<>("monitor.jvm.gc.collector." + collector + ".debug", randomTimeValue())); + entries.add(new AbstractMap.SimpleEntry<>("monitor.jvm.gc.collector." + collector + ".warn", randomPositiveTimeValue())); + entries.add(new AbstractMap.SimpleEntry<>("monitor.jvm.gc.collector." + collector + ".info", randomPositiveTimeValue())); + entries.add(new AbstractMap.SimpleEntry<>("monitor.jvm.gc.collector." + collector + ".debug", randomPositiveTimeValue())); Settings.Builder builder = Settings.builder(); // drop a random setting or two