Skip to content

Commit 6fd935b

Browse files
rishabhmauryabzhangam
authored andcommitted
Fix flaky test due to incorrect use of SSDV.nextOrd() (opensearch-project#17626)
Signed-off-by: Rishabh Maurya <[email protected]>
1 parent a6c0708 commit 6fd935b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/test/java/org/opensearch/index/fielddata/ordinals/MultiOrdinalsTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ public int compare(OrdAndId o1, OrdAndId o2) {
128128
assertThat((long) singleOrds.ordValue(), equalTo(docOrds.get(0)));
129129

130130
assertTrue(docs.advanceExact(docId));
131+
assertEquals(docOrds.size(), docs.docValueCount());
131132
for (Long ord : docOrds) {
132133
assertThat(docs.nextOrd(), equalTo(ord));
133134
}
134-
assertEquals(SortedSetDocValues.NO_MORE_DOCS, docs.nextOrd());
135135
}
136136
for (int i = docId + 1; i < ordAndId.id; i++) {
137137
assertFalse(singleOrds.advanceExact(i));
@@ -277,10 +277,10 @@ private void assertEquals(SortedSetDocValues docs, long[][] ordinalPlan) throws
277277
long[] ords = ordinalPlan[doc];
278278
assertEquals(ords.length > 0, docs.advanceExact(doc));
279279
if (ords.length > 0) {
280+
assertEquals(ords.length, docs.docValueCount());
280281
for (long ord : ords) {
281282
assertThat(docs.nextOrd(), equalTo(ord));
282283
}
283-
assertThat(docs.nextOrd(), equalTo((long) SortedSetDocValues.NO_MORE_DOCS));
284284
}
285285
}
286286
}

0 commit comments

Comments
 (0)