Skip to content

Commit

Permalink
Asserting segment's name in test
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Garg <[email protected]>
  • Loading branch information
Harsh Garg committed Sep 10, 2024
1 parent 0cc8d46 commit c2fb148
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.opensearch.test.OpenSearchTestCase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -95,6 +96,7 @@ public void testGetIndices() {
shardSegmentsList.add(new ShardSegments(shardRouting, segmentList));
}
}
Collections.shuffle(shardSegmentsList);

// Prepare the IndicesSegmentResponse object and get the indicesSegments map
IndicesSegmentResponse response = new IndicesSegmentResponse(
Expand All @@ -112,6 +114,10 @@ public void testGetIndices() {
for (IndexShardSegments indexShardSegment : indexSegmentEntry.getValue().getShards().values()) {
for (ShardSegments shardSegment : indexShardSegment.getShards()) {
assertEquals(segmentsPerShard, shardSegment.getSegments().size());
for (int i = 0; i < segmentsPerShard; i++) {
String segmentName = indexSegmentEntry.getKey() + shardSegment.getShardRouting().getId() + i;
assertEquals(segmentName, shardSegment.getSegments().get(i).getName());
}
}
}
}
Expand Down

0 comments on commit c2fb148

Please sign in to comment.