Skip to content

Commit 0865c8b

Browse files
committed
TEST: Fix range issue in ShardChangesActionTests
We modified the way we calculate to_seqno in #32121 but did not adjust this test accordingly. If min_seqno equals to max_seqno, the size should be one instead of zero. Relates #32121
1 parent 566f9b4 commit 0865c8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/ShardChangesActionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public void testGetOperations() throws Exception {
4444
for (int iter = 0; iter < iters; iter++) {
4545
int min = randomIntBetween(0, numWrites - 1);
4646
int max = randomIntBetween(min, numWrites - 1);
47-
int size = max - min;
47+
int size = max - min + 1;
4848
final Translog.Operation[] operations = ShardChangesAction.getOperations(indexShard,
4949
indexShard.getGlobalCheckpoint(), min, size, Long.MAX_VALUE);
5050
final List<Long> seenSeqNos = Arrays.stream(operations).map(Translog.Operation::seqNo).collect(Collectors.toList());
51-
final List<Long> expectedSeqNos = LongStream.range(min, max).boxed().collect(Collectors.toList());
51+
final List<Long> expectedSeqNos = LongStream.rangeClosed(min, max).boxed().collect(Collectors.toList());
5252
assertThat(seenSeqNos, equalTo(expectedSeqNos));
5353
}
5454

0 commit comments

Comments
 (0)