Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AmatyaAvadhanula committed Oct 16, 2023
1 parent b06217d commit 65b59fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,24 @@ public void testSegmentsToReplace()
final DataSegment segment2 = asSegment(pendingSegmentV02);
appendTask.commitAppendSegments(segment2);

// Despite segment2 existing, it is not chosen to be replaced because it was created after the tasklock was acquired
verifyInputSegments(replaceTask, JAN_23, segment1);

replaceTask.releaseLock(JAN_23);
replaceTask.acquireReplaceLockOn(FIRST_OF_JAN_23);

final SegmentIdWithShardSpec pendingSegmentV03
= appendTask.allocateSegmentForTimestamp(JAN_23.getStart(), Granularities.MONTH);
Assert.assertNotEquals(pendingSegmentV01.asSegmentId(), pendingSegmentV03.asSegmentId());
Assert.assertNotEquals(pendingSegmentV02.asSegmentId(), pendingSegmentV03.asSegmentId());
Assert.assertEquals(SEGMENT_V0, pendingSegmentV03.getVersion());
Assert.assertEquals(JAN_23, pendingSegmentV03.getInterval());
final DataSegment segment3 = asSegment(pendingSegmentV03);
appendTask.commitAppendSegments(segment3);

// The new lock was acquired before segment3 was created but it doesn't contain the month's interval
// So, all three segments are chosen
verifyInputSegments(replaceTask, JAN_23, segment1, segment2, segment3);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2586,11 +2586,11 @@ public void testRetrieveUsedSegmentsAndCreatedDates()

List<Pair<DataSegment, String>> resultForFirstHalfOfEternity =
coordinator.retrieveUsedSegmentsAndCreatedDates(defaultSegment.getDataSource(), firstHalfEternityRangeSegment.getInterval());
Assert.assertEquals(resultForExactInterval, resultForEternity);
Assert.assertEquals(resultForExactInterval, resultForFirstHalfOfEternity);

List<Pair<DataSegment, String>> resultForSecondHalfOfEternity =
coordinator.retrieveUsedSegmentsAndCreatedDates(defaultSegment.getDataSource(), secondHalfEternityRangeSegment.getInterval());
Assert.assertEquals(resultForExactInterval, resultForEternity);
Assert.assertEquals(resultForExactInterval, resultForSecondHalfOfEternity);
}

@Test
Expand Down

0 comments on commit 65b59fa

Please sign in to comment.