Skip to content

Commit

Permalink
Fix delete training model cleanup in bwc
Browse files Browse the repository at this point in the history
Signed-off-by: John Mazanec <[email protected]>
  • Loading branch information
jmazanec15 committed Apr 4, 2023
1 parent 2c1d73b commit 7b00ec7
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
import org.opensearch.knn.indices.ModelMetadata;
import org.opensearch.knn.indices.ModelState;
import org.opensearch.knn.plugin.KNNPlugin;
import org.opensearch.knn.plugin.transport.DeleteModelResponse;
import org.opensearch.rest.RestStatus;
import org.opensearch.search.SearchHit;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Locale;
import java.util.Map;

import static org.opensearch.knn.TestUtils.KNN_BWC_PREFIX;
Expand Down Expand Up @@ -156,6 +154,10 @@ public void testDeleteTrainingModel() throws Exception {

ResponseException ex = expectThrows(ResponseException.class, () -> client().performRequest(request));
assertEquals(RestStatus.CONFLICT.getStatus(), ex.getResponse().getStatusLine().getStatusCode());

Request deleteModeFromIndexRequest = new Request("DELETE", String.join("/", MODEL_INDEX_NAME, TEST_MODEL_ID_TRAINING));
Response r = client().performRequest(deleteModeFromIndexRequest);
assertEquals(RestStatus.OK.getStatus(), r.getStatusLine().getStatusCode());
}
}

Expand All @@ -165,7 +167,6 @@ public static void wipeAllModels() throws IOException {
if (!isRunningAgainstOldCluster()) {
deleteKNNModel(TEST_MODEL_ID);
deleteKNNModel(TEST_MODEL_ID_DEFAULT);
deleteKNNModel(TEST_MODEL_ID_TRAINING);

Request request = new Request("DELETE", "/" + MODEL_INDEX_NAME);

Expand Down

0 comments on commit 7b00ec7

Please sign in to comment.