From b639ffc702006a2826130a7db2cc113a6fb0e6b6 Mon Sep 17 00:00:00 2001 From: b4sjoo Date: Thu, 19 Dec 2024 10:44:40 +0000 Subject: [PATCH] Add UT Signed-off-by: b4sjoo --- .../opensearch/ml/utils/MLNodeUtilsTests.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugin/src/test/java/org/opensearch/ml/utils/MLNodeUtilsTests.java b/plugin/src/test/java/org/opensearch/ml/utils/MLNodeUtilsTests.java index 5b12e73d3c..e7c2784590 100644 --- a/plugin/src/test/java/org/opensearch/ml/utils/MLNodeUtilsTests.java +++ b/plugin/src/test/java/org/opensearch/ml/utils/MLNodeUtilsTests.java @@ -66,6 +66,31 @@ public void testValidateSchema() throws IOException { MLNodeUtils.validateSchema(schema, json); } + @Test + public void testValidateEmbeddingInputWithRemoteSchema() throws IOException { + String schema = "{\n" + + " \"type\": \"object\",\n" + + " \"properties\": {\n" + + " \"parameters\": {\n" + + " \"type\": \"object\",\n" + + " \"properties\": {\n" + + " \"texts\": {\n" + + " \"type\": \"array\",\n" + + " \"items\": {\n" + + " \"type\": \"string\"\n" + + " }\n" + + " }\n" + + " },\n" + + " \"required\": [\n" + + " \"texts\"\n" + + " ]\n" + + " }\n" + + " }\n" + + "}"; + String json = "{\"text_docs\":[ \"today is sunny\", \"today is sunny\"]}"; + MLNodeUtils.validateSchema(schema, json); + } + @Test public void testProcessRemoteInferenceInputDataSetParametersValueNoParameters() throws IOException { String json = "{\"key1\":\"foo\",\"key2\":123,\"key3\":true}";