Skip to content

Commit eaa5c3c

Browse files
committed
remove duplicate and unuseful remote inference ITs
Signed-off-by: Xun Zhang <xunzh@amazon.com>
1 parent 44ab851 commit eaa5c3c

File tree

1 file changed

+8
-72
lines changed

1 file changed

+8
-72
lines changed

plugin/src/test/java/org/opensearch/ml/rest/RestMLRemoteInferenceIT.java

+8-72
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.apache.hc.core5.http.HttpHeaders;
1616
import org.apache.hc.core5.http.message.BasicHeader;
1717
import org.junit.Before;
18+
import org.junit.Ignore;
1819
import org.junit.Rule;
1920
import org.junit.rules.ExpectedException;
2021
import org.opensearch.client.Response;
@@ -171,19 +172,6 @@ public void testSearchMLTasks_afterCreation() throws IOException {
171172
assertEquals((Double) 1.0, (Double) ((Map) ((Map) responseMap.get("hits")).get("total")).get("value"));
172173
}
173174

174-
public void testRegisterRemoteModel() throws IOException, InterruptedException {
175-
Response response = createConnector(completionModelConnectorEntity);
176-
Map responseMap = parseResponseToMap(response);
177-
String connectorId = (String) responseMap.get("connector_id");
178-
response = registerRemoteModel("openAI-GPT-3.5 completions", connectorId);
179-
responseMap = parseResponseToMap(response);
180-
String taskId = (String) responseMap.get("task_id");
181-
waitForTask(taskId, MLTaskState.COMPLETED);
182-
response = getTask(taskId);
183-
responseMap = parseResponseToMap(response);
184-
assertNotNull(responseMap.get("model_id"));
185-
}
186-
187175
public void testDeployRemoteModel() throws IOException, InterruptedException {
188176
Response response = createConnector(completionModelConnectorEntity);
189177
Map responseMap = parseResponseToMap(response);
@@ -202,42 +190,6 @@ public void testDeployRemoteModel() throws IOException, InterruptedException {
202190
waitForTask(taskId, MLTaskState.COMPLETED);
203191
}
204192

205-
public void testPredictRemoteModel() throws IOException, InterruptedException {
206-
// Skip test if key is null
207-
if (OPENAI_KEY == null) {
208-
return;
209-
}
210-
Response response = createConnector(completionModelConnectorEntity);
211-
Map responseMap = parseResponseToMap(response);
212-
String connectorId = (String) responseMap.get("connector_id");
213-
response = registerRemoteModel("openAI-GPT-3.5 completions", connectorId);
214-
responseMap = parseResponseToMap(response);
215-
String taskId = (String) responseMap.get("task_id");
216-
waitForTask(taskId, MLTaskState.COMPLETED);
217-
response = getTask(taskId);
218-
responseMap = parseResponseToMap(response);
219-
String modelId = (String) responseMap.get("model_id");
220-
response = deployRemoteModel(modelId);
221-
responseMap = parseResponseToMap(response);
222-
taskId = (String) responseMap.get("task_id");
223-
waitForTask(taskId, MLTaskState.COMPLETED);
224-
String predictInput = "{\n" + " \"parameters\": {\n" + " \"prompt\": \"Say this is a test\"\n" + " }\n" + "}";
225-
response = predictRemoteModel(modelId, predictInput);
226-
responseMap = parseResponseToMap(response);
227-
List responseList = (List) responseMap.get("inference_results");
228-
responseMap = (Map) responseList.get(0);
229-
responseList = (List) responseMap.get("output");
230-
responseMap = (Map) responseList.get(0);
231-
responseMap = (Map) responseMap.get("dataAsMap");
232-
responseList = (List) responseMap.get("choices");
233-
if (responseList == null) {
234-
assertTrue(checkThrottlingOpenAI(responseMap));
235-
return;
236-
}
237-
responseMap = (Map) responseList.get(0);
238-
assertFalse(((String) responseMap.get("text")).isEmpty());
239-
}
240-
241193
public void testPredictWithAutoDeployAndTTL_RemoteModel() throws IOException, InterruptedException {
242194
// Skip test if key is null
243195
if (OPENAI_KEY == null) {
@@ -335,26 +287,6 @@ public void testPredictRemoteModelWithWrongOutputInterface() throws IOException,
335287
});
336288
}
337289

338-
public void testUndeployRemoteModel() throws IOException, InterruptedException {
339-
Response response = createConnector(completionModelConnectorEntity);
340-
Map responseMap = parseResponseToMap(response);
341-
String connectorId = (String) responseMap.get("connector_id");
342-
response = registerRemoteModel("openAI-GPT-3.5 completions", connectorId);
343-
responseMap = parseResponseToMap(response);
344-
String taskId = (String) responseMap.get("task_id");
345-
waitForTask(taskId, MLTaskState.COMPLETED);
346-
response = getTask(taskId);
347-
responseMap = parseResponseToMap(response);
348-
String modelId = (String) responseMap.get("model_id");
349-
response = deployRemoteModel(modelId);
350-
responseMap = parseResponseToMap(response);
351-
taskId = (String) responseMap.get("task_id");
352-
waitForTask(taskId, MLTaskState.COMPLETED);
353-
response = undeployRemoteModel(modelId);
354-
responseMap = parseResponseToMap(response);
355-
assertTrue(responseMap.toString().contains("undeployed"));
356-
}
357-
358290
public void testOpenAIChatCompletionModel() throws IOException, InterruptedException {
359291
// Skip test if key is null
360292
if (OPENAI_KEY == null) {
@@ -418,8 +350,12 @@ public void testOpenAIChatCompletionModel() throws IOException, InterruptedExcep
418350
responseMap = parseResponseToMap(response);
419351
// TODO handle throttling error
420352
assertNotNull(responseMap);
421-
}
422353

354+
response = undeployRemoteModel(modelId);
355+
responseMap = parseResponseToMap(response);
356+
assertTrue(responseMap.toString().contains("undeployed"));
357+
}
358+
@Ignore
423359
public void testOpenAIEditsModel() throws IOException, InterruptedException {
424360
// Skip test if key is null
425361
if (OPENAI_KEY == null) {
@@ -490,7 +426,7 @@ public void testOpenAIEditsModel() throws IOException, InterruptedException {
490426

491427
assertFalse(((String) responseMap.get("content")).isEmpty());
492428
}
493-
429+
@Ignore
494430
public void testOpenAIModerationsModel() throws IOException, InterruptedException {
495431
// Skip test if key is null
496432
if (OPENAI_KEY == null) {
@@ -720,7 +656,7 @@ public void testCohereGenerateTextModel() throws IOException, InterruptedExcepti
720656
responseMap = (Map) responseList.get(0);
721657
assertFalse(((String) responseMap.get("text")).isEmpty());
722658
}
723-
659+
@Ignore
724660
public void testCohereClassifyModel() throws IOException, InterruptedException {
725661
// Skip test if key is null
726662
if (COHERE_KEY == null) {

0 commit comments

Comments
 (0)