Skip to content

Commit 0e9963d

Browse files
committed
Fix off-by-one in testDoesNotSubmitRerouteTaskTooFrequently (#72313)
We reroute when the elapsed time is >= 60000ms, but the test assumes that no reroute happens exactly at 60000ms. This commit fixes this off-by-one-ms error. Relates #60869 which introduced this test issue Relates #68316 which mostly fixed this test issue except this one spot Closes #71424
1 parent 914b1ea commit 0e9963d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

server/src/test/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdMonitorTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi
154154
assertEquals(Collections.singleton("test_1"), indices.get());
155155
}
156156

157-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/71424")
158157
public void testDoesNotSubmitRerouteTaskTooFrequently() {
159158
final ClusterState clusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
160159
.nodes(DiscoveryNodes.builder().add(newNormalNode("node1")).add(newNormalNode("node2"))).build();
@@ -198,7 +197,7 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi
198197
if (randomBoolean()) {
199198
// should not re-route again within the reroute interval
200199
currentTime.addAndGet(randomLongBetween(0,
201-
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis()));
200+
DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.get(Settings.EMPTY).millis() - 1));
202201
monitor.onNewInfo(clusterInfo(allDisksOk));
203202
assertNull(listenerReference.get());
204203
}

0 commit comments

Comments
 (0)