Skip to content

Commit

Permalink
Fix off-by-one in testDoesNotSubmitRerouteTaskTooFrequently (#72313)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DaveCTurner committed Apr 27, 2021
1 parent 914b1ea commit 0e9963d
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ protected void updateIndicesReadOnly(Set<String> indicesToMarkReadOnly, ActionLi
assertEquals(Collections.singleton("test_1"), indices.get());
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/71424")
public void testDoesNotSubmitRerouteTaskTooFrequently() {
final ClusterState clusterState = ClusterState.builder(ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY))
.nodes(DiscoveryNodes.builder().add(newNormalNode("node1")).add(newNormalNode("node2"))).build();
Expand Down Expand Up @@ -198,7 +197,7 @@ protected void updateIndicesReadOnly(Set<String> 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());
}
Expand Down

0 comments on commit 0e9963d

Please sign in to comment.