Skip to content

Commit 29f443f

Browse files
when key is null, skip running predict (#2402) (#2404)
1 parent 32c9ef8 commit 29f443f

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public void testMLInferenceProcessorWithObjectFieldType() throws Exception {
112112
String index_name = "daily_index";
113113
createPipelineProcessor(createPipelineRequestBody, "diary_embedding_pipeline");
114114
createIndex(index_name, createIndexRequestBody);
115+
// Skip test if key is null
116+
if (OPENAI_KEY == null) {
117+
return;
118+
}
115119
uploadDocument(index_name, "1", uploadDocumentRequestBody);
116120
Map document = getDocument(index_name, "1");
117121
List embeddingList = JsonPath.parse(document).read("_source.diary_embedding");
@@ -194,6 +198,10 @@ public void testMLInferenceProcessorWithNestedFieldType() throws Exception {
194198
String index_name = "book_index";
195199
createPipelineProcessor(createPipelineRequestBody, "embedding_pipeline");
196200
createIndex(index_name, createIndexRequestBody);
201+
// Skip test if key is null
202+
if (OPENAI_KEY == null) {
203+
return;
204+
}
197205
uploadDocument(index_name, "1", uploadDocumentRequestBody);
198206
Map document = getDocument(index_name, "1");
199207

0 commit comments

Comments
 (0)