Skip to content

Commit

Permalink
Use ml plugin system index prefix to skip delete
Browse files Browse the repository at this point in the history
Signed-off-by: Junqiu Lei <[email protected]>
  • Loading branch information
junqiu-lei committed Jan 25, 2024
1 parent b1418df commit 5b9e8a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/testFixtures/java/org/opensearch/knn/ODFERestTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

import static org.opensearch.knn.TestUtils.KNN_BWC_PREFIX;
import static org.opensearch.knn.TestUtils.OPENDISTRO_SECURITY;
import static org.opensearch.knn.TestUtils.ML_PLUGIN_SYSTEM_INDEX_PREFIX;
import static org.opensearch.knn.TestUtils.OPENSEARCH_SYSTEM_INDEX_PREFIX;
import static org.opensearch.knn.TestUtils.PLUGINS_ML_CONFIG_INDEX_NAME;
import static org.opensearch.knn.TestUtils.SECURITY_AUDITLOG_PREFIX;
import static org.opensearch.knn.TestUtils.SKIP_DELETE_MODEL_INDEX;
import static org.opensearch.knn.common.KNNConstants.MODELS;
Expand All @@ -63,7 +63,12 @@
*/
public abstract class ODFERestTestCase extends OpenSearchRestTestCase {

private final Set<String> IMMUTABLE_INDEX_PREFIXES = Set.of(KNN_BWC_PREFIX, SECURITY_AUDITLOG_PREFIX, OPENSEARCH_SYSTEM_INDEX_PREFIX);
private final Set<String> IMMUTABLE_INDEX_PREFIXES = Set.of(
KNN_BWC_PREFIX,
SECURITY_AUDITLOG_PREFIX,
OPENSEARCH_SYSTEM_INDEX_PREFIX,
ML_PLUGIN_SYSTEM_INDEX_PREFIX
);

protected boolean isHttps() {
return Optional.ofNullable(System.getProperty("https")).map("true"::equalsIgnoreCase).orElse(false);
Expand Down Expand Up @@ -213,7 +218,6 @@ private boolean skipDeleteIndex(String indexName) {
return indexName == null
|| OPENDISTRO_SECURITY.equals(indexName)
|| IMMUTABLE_INDEX_PREFIXES.stream().anyMatch(indexName::startsWith)
|| MODEL_INDEX_NAME.equals(indexName)
|| PLUGINS_ML_CONFIG_INDEX_NAME.equals(indexName);
|| MODEL_INDEX_NAME.equals(indexName);
}
}
2 changes: 1 addition & 1 deletion src/testFixtures/java/org/opensearch/knn/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class TestUtils {
public static final String UPGRADED_CLUSTER = "upgraded_cluster";
public static final String SECURITY_AUDITLOG_PREFIX = "security-auditlog";
public static final String OPENSEARCH_SYSTEM_INDEX_PREFIX = ".opensearch";
public static final String PLUGINS_ML_CONFIG_INDEX_NAME = ".plugins-ml-config";
public static final String ML_PLUGIN_SYSTEM_INDEX_PREFIX = ".plugins-ml";

// Generating vectors using random function with a seed which makes these vectors standard and generate same vectors for each run.
public static float[][] randomlyGenerateStandardVectors(int numVectors, int dimensions, int seed) {
Expand Down

0 comments on commit 5b9e8a9

Please sign in to comment.