From 9854162da204387114c2f3b39712c133364675dc Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 3 May 2024 09:11:24 -0700 Subject: [PATCH] when key is null, skip running predict (#2402) (#2403) (cherry picked from commit 950f8647bbbdc4ffc9c9a10afd0bf8ca689e563b) Co-authored-by: Mingshi Liu --- .../ml/rest/RestMLInferenceIngestProcessorIT.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/src/test/java/org/opensearch/ml/rest/RestMLInferenceIngestProcessorIT.java b/plugin/src/test/java/org/opensearch/ml/rest/RestMLInferenceIngestProcessorIT.java index 8b64b36c0e..ae4379cc4e 100644 --- a/plugin/src/test/java/org/opensearch/ml/rest/RestMLInferenceIngestProcessorIT.java +++ b/plugin/src/test/java/org/opensearch/ml/rest/RestMLInferenceIngestProcessorIT.java @@ -112,6 +112,10 @@ public void testMLInferenceProcessorWithObjectFieldType() throws Exception { String index_name = "daily_index"; createPipelineProcessor(createPipelineRequestBody, "diary_embedding_pipeline"); createIndex(index_name, createIndexRequestBody); + // Skip test if key is null + if (OPENAI_KEY == null) { + return; + } uploadDocument(index_name, "1", uploadDocumentRequestBody); Map document = getDocument(index_name, "1"); List embeddingList = JsonPath.parse(document).read("_source.diary_embedding"); @@ -194,6 +198,10 @@ public void testMLInferenceProcessorWithNestedFieldType() throws Exception { String index_name = "book_index"; createPipelineProcessor(createPipelineRequestBody, "embedding_pipeline"); createIndex(index_name, createIndexRequestBody); + // Skip test if key is null + if (OPENAI_KEY == null) { + return; + } uploadDocument(index_name, "1", uploadDocumentRequestBody); Map document = getDocument(index_name, "1");