Skip to content

Commit 7e0b870

Browse files
committed
fix failing test
1 parent ffb2a6a commit 7e0b870

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x-pack/plugin/rank-rrf/src/test/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilderTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.elasticsearch.xcontent.json.JsonXContent;
3838

3939
import java.io.IOException;
40+
import java.util.Arrays;
4041
import java.util.HashMap;
4142
import java.util.HashSet;
4243
import java.util.List;
@@ -511,7 +512,12 @@ public void testInferenceFieldWeights() {
511512

512513
assertNotNull("Inner RRFRetrieverBuilder should exist", innerRrf);
513514
float[] actualWeights = innerRrf.weights();
515+
assertEquals("Should have exactly 2 weights", 2, actualWeights.length);
516+
517+
// Sort both arrays to ensure deterministic comparison regardless of HashMap iteration order
514518
float[] expectedWeights = new float[] { 3.0f, 0.5f };
519+
Arrays.sort(actualWeights);
520+
Arrays.sort(expectedWeights);
515521
assertArrayEquals(expectedWeights, actualWeights, 0.001f);
516522
}
517523

0 commit comments

Comments
 (0)