use of org.opensearch.plugins.MetadataUpgrader in project OpenSearch by opensearch-project.
the class GatewayMetaStateTests method testIndexTemplateValidation.
public void testIndexTemplateValidation() {
Metadata metadata = randomMetadata();
MetadataUpgrader metadataUpgrader = new MetadataUpgrader(Collections.singletonList(customs -> {
throw new IllegalStateException("template is incompatible");
}));
String message = expectThrows(IllegalStateException.class, () -> GatewayMetaState.upgradeMetadata(metadata, new MockMetadataIndexUpgradeService(false), metadataUpgrader)).getMessage();
assertThat(message, equalTo("template is incompatible"));
}
use of org.opensearch.plugins.MetadataUpgrader in project OpenSearch by opensearch-project.
the class GatewayMetaStateTests method testCustomMetadataValidation.
public void testCustomMetadataValidation() {
Metadata metadata = randomMetadata(new CustomMetadata1("data"));
MetadataUpgrader metadataUpgrader = new MetadataUpgrader(Collections.emptyList());
try {
GatewayMetaState.upgradeMetadata(metadata, new MockMetadataIndexUpgradeService(false), metadataUpgrader);
} catch (IllegalStateException e) {
assertThat(e.getMessage(), equalTo("custom meta data too old"));
}
}
Aggregations