Skip to content

Commit 1ff495e

Browse files
change to non-negative random longs in testing; add a few checks in InternalClusterInfoServiceSchedulingTests to verify the new method is called
1 parent ea0be4b commit 1ff495e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

server/src/test/java/org/elasticsearch/cluster/ClusterInfoTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private static Map<ShardId, ShardAndIndexHeapUsage> randomShardHeapUsages() {
7474
int numEntries = randomIntBetween(0, 128);
7575
Map<ShardId, ShardAndIndexHeapUsage> shardHeapUsageBuilder = new HashMap<>(numEntries);
7676
for (int i = 0; i < numEntries; i++) {
77-
shardHeapUsageBuilder.put(randomShardId(), new ShardAndIndexHeapUsage(randomLong(), randomLong()));
77+
shardHeapUsageBuilder.put(randomShardId(), new ShardAndIndexHeapUsage(randomNonNegativeLong(), randomNonNegativeLong()));
7878
}
7979
return shardHeapUsageBuilder;
8080
}

server/src/test/java/org/elasticsearch/cluster/InternalClusterInfoServiceSchedulingTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public void reroute(String reason, Priority priority, ActionListener<Void> liste
154154
// should have run two client requests: nodes stats request and indices stats request
155155
assertThat(client.requestCount, equalTo(initialRequestCount + 2));
156156
verify(mockEstimatedHeapUsageCollector).collectClusterHeapUsage(any()); // Should have polled for heap usage
157+
verify(mockEstimatedHeapUsageCollector).collectShardHeapUsage(any());
157158
verify(nodeUsageStatsForThreadPoolsCollector).collectUsageStats(any(), any(), any());
158159
}
159160

@@ -202,6 +203,7 @@ public void reroute(String reason, Priority priority, ActionListener<Void> liste
202203
deterministicTaskQueue.runAllRunnableTasks();
203204
assertThat(client.requestCount, equalTo(initialRequestCount + 2)); // should have run two client requests per interval
204205
verify(mockEstimatedHeapUsageCollector).collectClusterHeapUsage(any()); // Should poll for heap usage once per interval
206+
verify(mockEstimatedHeapUsageCollector).collectShardHeapUsage(any());
205207
verify(nodeUsageStatsForThreadPoolsCollector).collectUsageStats(any(), any(), any());
206208
}
207209

0 commit comments

Comments
 (0)