use of org.elasticsearch.cluster.metadata.IndexGraveyard in project crate by crate.
the class DanglingIndicesStateTests method testDanglingIndicesNotImportedWhenTombstonePresent.
public void testDanglingIndicesNotImportedWhenTombstonePresent() throws Exception {
try (NodeEnvironment env = newNodeEnvironment()) {
MetaStateService metaStateService = new MetaStateService(env, xContentRegistry());
DanglingIndicesState danglingState = createDanglingIndicesState(env, metaStateService);
final Settings.Builder settings = Settings.builder().put(indexSettings).put(IndexMetadata.SETTING_INDEX_UUID, "test1UUID");
IndexMetadata dangledIndex = IndexMetadata.builder("test1").settings(settings).build();
metaStateService.writeIndex("test_write", dangledIndex);
final IndexGraveyard graveyard = IndexGraveyard.builder().addTombstone(dangledIndex.getIndex()).build();
final Metadata metadata = Metadata.builder().indexGraveyard(graveyard).build();
assertThat(danglingState.findNewDanglingIndices(metadata).size(), equalTo(0));
}
}
Aggregations