Skip to content

Commit 950f864

Browse files
authored
when key is null, skip running predict (opensearch-project#2402)
1 parent a98dbbf commit 950f864

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ public void testMLInferenceProcessorWithObjectFieldType() throws Exception {
115115
String index_name = "daily_index";
116116
createPipelineProcessor(createPipelineRequestBody, "diary_embedding_pipeline");
117117
createIndex(index_name, createIndexRequestBody);
118+
// Skip test if key is null
119+
if (OPENAI_KEY == null) {
120+
return;
121+
}
118122
uploadDocument(index_name, "1", uploadDocumentRequestBody);
119123
Map document = getDocument(index_name, "1");
120124
List embeddingList = JsonPath.parse(document).read("_source.diary_embedding");
@@ -197,6 +201,10 @@ public void testMLInferenceProcessorWithNestedFieldType() throws Exception {
197201
String index_name = "book_index";
198202
createPipelineProcessor(createPipelineRequestBody, "embedding_pipeline");
199203
createIndex(index_name, createIndexRequestBody);
204+
// Skip test if key is null
205+
if (OPENAI_KEY == null) {
206+
return;
207+
}
200208
uploadDocument(index_name, "1", uploadDocumentRequestBody);
201209
Map document = getDocument(index_name, "1");
202210

0 commit comments

Comments
 (0)