Skip to content

Commit 3e7065b

Browse files
committed
fix UT failure caused by code change
Signed-off-by: zane-neo <[email protected]>
1 parent a2d5aab commit 3e7065b

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

ml-algorithms/src/test/java/org/opensearch/ml/engine/tools/SearchIndexToolTests.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,21 @@ public void testGetType() {
8080
@SneakyThrows
8181
public void testDefaultAttributes() {
8282
Map<String, Object> attributes = mockedSearchIndexTool.getAttributes();
83-
assertEquals(
84-
"{\"type\":\"object\",\"properties\":"
85-
+ "{\"index\":{\"type\":\"string\",\"description\":\"OpenSearch index name. for example: index1\"},"
86-
+ "\"query\":{\"type\":\"object\",\"description\":\"OpenSearch search index query. "
87-
+ "You need to get index mapping to write correct search query. It must be a valid OpenSearch query. "
88-
+ "Valid value:\\n{\\\"query\\\":{\\\"match\\\":{\\\"population_description\\\":\\\"seattle 2023 population\\\"}},\\\"size\\\":2,\\\"_source\\\":\\\"population_description\\\"}"
89-
+ "\\nInvalid value: \\n{\\\"match\\\":{\\\"population_description\\\":\\\"seattle 2023 population\\\"}}\\nThe value is invalid because the match not wrapped by \\\"query\\\".\","
90-
+ "\"additionalProperties\":false}},\"required\":[\"index\",\"query\"],\"additionalProperties\":false}",
83+
assertEquals("""
84+
{
85+
"input": {
86+
"index": {
87+
"type": "string",
88+
"description": "OpenSearch index name. for example: index1"
89+
},
90+
"query": {
91+
"type": "object",
92+
"description": "OpenSearch search index query. You need to get index mapping to write correct search query. It must be a valid OpenSearch query. Valid value:\\n{\\"query\\":{\\"match\\":{\\"population_description\\":\\"seattle 2023 population\\"}},\\"size\\":2,\\"_source\\":\\"population_description\\"}\\nInvalid value: \\n{\\"match\\":{\\"population_description\\":\\"seattle 2023 population\\"}}\\nThe value is invalid because the match not wrapped by \\"query\\".",
93+
"additionalProperties": false
94+
}
95+
}
96+
}
97+
""",
9198
attributes.get(INPUT_SCHEMA_FIELD)
9299
);
93100
assertEquals(false, attributes.get(STRICT_FIELD));

0 commit comments

Comments
 (0)