From 35e70839b37cfe8b025404c52d292e1544d80b8a Mon Sep 17 00:00:00 2001 From: Sarthak Aggarwal Date: Wed, 6 Sep 2023 09:54:33 +0530 Subject: [PATCH] nit fixes Signed-off-by: Sarthak Aggarwal --- .../index/codec/ZstdNotEnabledIT.java | 28 +++++++++++-------- .../opensearch/index/codec/CodecAliases.java | 2 ++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/index/codec/ZstdNotEnabledIT.java b/server/src/internalClusterTest/java/org/opensearch/index/codec/ZstdNotEnabledIT.java index b499f608cf1c8..9b1fa77fc9a5a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/codec/ZstdNotEnabledIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/codec/ZstdNotEnabledIT.java @@ -12,6 +12,8 @@ import org.opensearch.common.settings.Settings; import org.opensearch.test.OpenSearchIntegTestCase; +import java.util.List; + @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST) public class ZstdNotEnabledIT extends OpenSearchIntegTestCase { @@ -20,18 +22,20 @@ public void testZStdCodecsWithoutPluginInstalled() { internalCluster().startNode(); final String index = "test-index"; - // creating index with zstd or zstd_no_dict should fail if custom-codecs plugin is not installed - assertThrows( - IllegalArgumentException.class, - () -> createIndex( - index, - Settings.builder() - .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.codec", randomFrom("zstd", "zstd_no_dict")) - .build() - ) - ); + // creating index with zstd and zstd_no_dict should fail if custom-codecs plugin is not installed + for (String codec : List.of("zstd", "zstd_no_dict")) { + assertThrows( + IllegalArgumentException.class, + () -> createIndex( + index, + Settings.builder() + .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) + .put("index.codec", codec) + .build() + ) + ); + } } } diff --git a/server/src/main/java/org/opensearch/index/codec/CodecAliases.java b/server/src/main/java/org/opensearch/index/codec/CodecAliases.java index 3b552e4fd8817..066c092e86db8 100644 --- a/server/src/main/java/org/opensearch/index/codec/CodecAliases.java +++ b/server/src/main/java/org/opensearch/index/codec/CodecAliases.java @@ -9,6 +9,7 @@ package org.opensearch.index.codec; import org.apache.lucene.codecs.Codec; +import org.opensearch.common.annotation.ExperimentalApi; import java.util.Set; @@ -17,6 +18,7 @@ * * @opensearch.internal */ +@ExperimentalApi public interface CodecAliases { /**