use of org.neo4j.index.SetInitialStateInNativeIndex in project neo4j by neo4j.
the class IndexCleanupIT method mustClearIndexDirectoryOnDropWhileFailed.
@ParameterizedTest
@EnumSource(SchemaIndex.class)
void mustClearIndexDirectoryOnDropWhileFailed(SchemaIndex schemaIndex) throws IOException {
configureDb(schemaIndex);
createIndex(db, true);
IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor(schemaIndex.providerKey(), schemaIndex.providerVersion());
SetInitialStateInNativeIndex setInitialStateInNativeIndex = new SetInitialStateInNativeIndex(BYTE_FAILED, providerDescriptor);
restartDatabase(schemaIndex, setInitialStateInNativeIndex);
try (Transaction tx = db.beginTx()) {
for (IndexDefinition index : tx.schema().getIndexes()) {
// ignore the lookup indexes which are there by default and have nothing to do with this test
if (index.getIndexType() == IndexType.LOOKUP) {
continue;
}
IndexState indexState = tx.schema().getIndexState(index);
assertEquals(IndexState.FAILED, indexState, "expected index state to be " + IndexState.FAILED);
}
tx.commit();
}
// when
dropAllIndexes();
// then
assertNoIndexFilesExisting(providerDirectories(fs, db));
}
Aggregations