use of org.opensearch.test.hamcrest.RegexMatcher in project OpenSearch by opensearch-project.
the class IndicesServiceTests method testConflictingEngineFactories.
public void testConflictingEngineFactories() {
final String indexName = "foobar";
final Index index = new Index(indexName, UUIDs.randomBase64UUID());
final Settings settings = Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, Version.CURRENT).put(IndexMetadata.SETTING_INDEX_UUID, index.getUUID()).put(FooEnginePlugin.FOO_INDEX_SETTING.getKey(), true).put(BarEnginePlugin.BAR_INDEX_SETTING.getKey(), true).build();
final IndexMetadata indexMetadata = new IndexMetadata.Builder(index.getName()).settings(settings).numberOfShards(1).numberOfReplicas(0).build();
final IndicesService indicesService = getIndicesService();
final IllegalStateException e = expectThrows(IllegalStateException.class, () -> indicesService.createIndex(indexMetadata, Collections.emptyList(), false));
final String pattern = ".*multiple engine factories provided for \\[foobar/.*\\]: \\[.*FooEngineFactory\\],\\[.*BarEngineFactory\\].*";
assertThat(e, hasToString(new RegexMatcher(pattern)));
}
Aggregations