@Test
public void testIndexWithTransformError() throws Exception {
QueryOptions queryOptions = new QueryOptions(VariantStorageEngine.Options.ANNOTATE.key(), false)
.append(VariantStorageEngine.Options.CALCULATE_STATS.key(), false);
DummyVariantStoragePipeline storageETL = mockVariantStorageETL();
List<File> files = Arrays.asList(getFile(0), getFile(1));
StorageEngineException transformException = StorageEngineException.unableToExecute("transform", 0, "");
Mockito.doThrow(transformException).when(storageETL)
.transform(ArgumentMatchers.argThat(argument -> argument.toString().contains(files.get(1).getName())), Mockito.any(), Mockito.any());
try {
indexFiles(files, queryOptions, outputId);
} catch (StoragePipelineException exception) {
assertEquals(files.size(), exception.getResults().size());
assertTrue(exception.getResults().get(0).isTransformExecuted());
assertNull(exception.getResults().get(0).getTransformError());
assertTrue(exception.getResults().get(1).isTransformExecuted());
assertSame(transformException, exception.getResults().get(1).getTransformError());
for (int i = files.size(); i > 0; i--) {
assertFalse(exception.getResults().get(1).isLoadExecuted());
assertNull(exception.getResults().get(1).getLoadError());
}
}
mockVariantStorageETL();
indexFiles(files, singletonList(files.get(1)), queryOptions, outputId);
}