use of org.apache.kafka.clients.admin.DeleteRecordsResult in project kafka by apache.
the class TaskManagerTest method shouldIgnorePurgeDataErrors.
@Test
public void shouldIgnorePurgeDataErrors() {
final StateMachineTask task00 = new StateMachineTask(taskId00, taskId00Partitions, true);
expectRestoreToBeCompleted(consumer, changeLogReader);
expect(activeTaskCreator.createTasks(anyObject(), eq(taskId00Assignment))).andStubReturn(singletonList(task00));
final KafkaFutureImpl<DeletedRecords> futureDeletedRecords = new KafkaFutureImpl<>();
final DeleteRecordsResult deleteRecordsResult = new DeleteRecordsResult(singletonMap(t1p1, futureDeletedRecords));
futureDeletedRecords.completeExceptionally(new Exception("KABOOM!"));
expect(adminClient.deleteRecords(anyObject())).andReturn(deleteRecordsResult).times(2);
replay(activeTaskCreator, adminClient, consumer, changeLogReader);
taskManager.handleAssignment(taskId00Assignment, emptyMap());
assertThat(taskManager.tryToCompleteRestoration(time.milliseconds(), null), is(true));
assertThat(task00.state(), is(Task.State.RUNNING));
task00.setPurgeableOffsets(singletonMap(t1p1, 5L));
taskManager.maybePurgeCommittedRecords();
taskManager.maybePurgeCommittedRecords();
verify(adminClient);
}
Aggregations