use of com.palantir.atlasdb.sweep.progress.SweepProgress in project atlasdb by palantir.
the class BackgroundSweeperFastTest method testWriteProgressAfterIncompleteRunUsesSystemTimeForStart.
@Test
public void testWriteProgressAfterIncompleteRunUsesSystemTimeForStart() {
setNoProgress();
setNextTableToSweep(TABLE_REF);
setupTaskRunner(ImmutableSweepResults.builder().staleValuesDeleted(2).cellTsPairsExamined(10).minSweptTimestamp(12345L).nextStartRow(Optional.of(new byte[] { 1, 2, 3 })).timeInMillis(10L).timeSweepStarted(Long.MAX_VALUE).build());
backgroundSweeper.runOnce();
ArgumentCaptor<SweepProgress> argumentCaptor = ArgumentCaptor.forClass(SweepProgress.class);
Mockito.verify(progressStore).saveProgress(argumentCaptor.capture());
SweepProgress savedProgress = argumentCaptor.getValue();
long timeSweepStarted = savedProgress.startTimeInMillis();
Assertions.assertThat(timeSweepStarted).isLessThanOrEqualTo(System.currentTimeMillis());
Assertions.assertThat(timeSweepStarted).isGreaterThan(System.currentTimeMillis() - 1000L);
Assertions.assertThat(savedProgress).isEqualTo(ImmutableSweepProgress.builder().tableRef(TABLE_REF).staleValuesDeleted(2).cellTsPairsExamined(10).minimumSweptTimestamp(12345L).startRow(new byte[] { 1, 2, 3 }).startColumn(PtBytes.toBytes("unused")).timeInMillis(10L).startTimeInMillis(timeSweepStarted).build());
}
Aggregations