diff --git a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdMonitorTests.java b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdMonitorTests.java index 3356ebee64aec..fdcbbaad44820 100644 --- a/server/src/test/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdMonitorTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdMonitorTests.java @@ -109,7 +109,7 @@ protected void updateIndicesReadOnly(Set indicesToMarkReadOnly, ActionLi builder = ImmutableOpenMap.builder(); builder.put("node1", new DiskUsage("node1","node1", "/foo/bar", 100, 4)); builder.put("node2", new DiskUsage("node2","node2", "/foo/bar", 100, 5)); - currentTime.addAndGet(randomLongBetween(60001, 120000)); + currentTime.addAndGet(randomLongBetween(60000, 120000)); monitor.onNewInfo(clusterInfo(builder.build())); assertTrue(reroute.get()); assertEquals(new HashSet<>(Arrays.asList("test_1", "test_2")), indices.get()); @@ -201,7 +201,7 @@ protected void updateIndicesReadOnly(Set indicesToMarkReadOnly, ActionLi // should reroute again when one disk is still over the watermark currentTime.addAndGet(randomLongBetween( - DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() + 1, 120000)); + DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis(), 120000)); monitor.onNewInfo(clusterInfo(oneDiskAboveWatermark)); assertNotNull(listenerReference.get()); final ActionListener rerouteListener1 = listenerReference.getAndSet(null); @@ -217,14 +217,14 @@ protected void updateIndicesReadOnly(Set indicesToMarkReadOnly, ActionLi if (randomBoolean()) { // should not re-route again within the reroute interval currentTime.addAndGet(randomLongBetween(0, - DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis())); + DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() - 1)); monitor.onNewInfo(clusterInfo(allDisksOk)); assertNull(listenerReference.get()); } // should reroute again after the reroute interval currentTime.addAndGet(randomLongBetween( - DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() + 1, 120000)); + DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis(), 120000)); monitor.onNewInfo(clusterInfo(allDisksOk)); assertNotNull(listenerReference.get()); listenerReference.getAndSet(null).onResponse(null); @@ -241,7 +241,7 @@ protected void updateIndicesReadOnly(Set indicesToMarkReadOnly, ActionLi final ImmutableOpenMap reservedSpaces = builder.build(); currentTime.addAndGet(randomLongBetween( - DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() + 1, 120000)); + DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis(), 120000)); monitor.onNewInfo(clusterInfo(allDisksOk, reservedSpaces)); assertNotNull(listenerReference.get()); listenerReference.getAndSet(null).onResponse(null);