Skip to content

Tighten up assertion in shard write load test #131659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,16 @@ public void testShardWriteLoadsArePresent() {
// Verify that each shard has write-load reported.
final ClusterState state = getInstanceFromNode(ClusterService.class).state();
assertEquals(state.projectState(ProjectId.DEFAULT).metadata().getTotalNumberOfShards(), shardWriteLoads.size());
double maximumLoadRecorded = 0;
for (IndexMetadata indexMetadata : state.projectState(ProjectId.DEFAULT).metadata()) {
double maximumLoadRecorded = 0;
for (int i = 0; i < indexMetadata.getNumberOfShards(); i++) {
final ShardId shardId = new ShardId(indexMetadata.getIndex(), i);
assertTrue(shardWriteLoads.containsKey(shardId));
maximumLoadRecorded = Math.max(shardWriteLoads.get(shardId), maximumLoadRecorded);
}
// Each index should have seen some write-load
assertThat(maximumLoadRecorded, greaterThan(0.0));
}
// And that at least one is greater than zero
assertThat(maximumLoadRecorded, greaterThan(0.0));
} finally {
updateClusterSettings(
Settings.builder().putNull(WriteLoadConstraintSettings.WRITE_LOAD_DECIDER_ENABLED_SETTING.getKey()).build()
Expand Down