From 8c23d8e467b4170908b9311401cc982c5890feff Mon Sep 17 00:00:00 2001 From: Siddhant Deshmukh Date: Wed, 4 Sep 2024 11:30:21 -0700 Subject: [PATCH] Fix settings name in tests Signed-off-by: Siddhant Deshmukh --- .../insights/QueryInsightsRestTestCase.java | 2 +- .../grouper/MinMaxQueryGrouperByNoneIT.java | 2 +- .../MinMaxQueryGrouperBySimilarityIT.java | 30 ++++++++++++++----- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/test/java/org/opensearch/plugin/insights/QueryInsightsRestTestCase.java b/src/test/java/org/opensearch/plugin/insights/QueryInsightsRestTestCase.java index 2852dec..15f5239 100644 --- a/src/test/java/org/opensearch/plugin/insights/QueryInsightsRestTestCase.java +++ b/src/test/java/org/opensearch/plugin/insights/QueryInsightsRestTestCase.java @@ -201,7 +201,7 @@ protected String defaultTopQueryGroupingSettings() { + " \"search.insights.top_queries.latency.window_size\" : \"1m\",\n" + " \"search.insights.top_queries.latency.top_n_size\" : 5,\n" + " \"search.insights.top_queries.group_by\" : \"similarity\",\n" - + " \"search.insights.top_queries.max_groups\" : 5\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : 5\n" + " }\n" + "}"; } diff --git a/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperByNoneIT.java b/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperByNoneIT.java index 86ae244..c7779cb 100644 --- a/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperByNoneIT.java +++ b/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperByNoneIT.java @@ -65,7 +65,7 @@ private String groupByNoneSettings() { + " \"search.insights.top_queries.latency.window_size\" : \"1m\",\n" + " \"search.insights.top_queries.latency.top_n_size\" : 100,\n" + " \"search.insights.top_queries.group_by\" : \"none\",\n" - + " \"search.insights.top_queries.max_groups\" : 5\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : 5\n" + " }\n" + "}"; } diff --git a/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperBySimilarityIT.java b/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperBySimilarityIT.java index 66567b1..e32b609 100644 --- a/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperBySimilarityIT.java +++ b/src/test/java/org/opensearch/plugin/insights/core/service/grouper/MinMaxQueryGrouperBySimilarityIT.java @@ -96,11 +96,19 @@ public void testValidQueryGroupingSettings() throws IOException { private String[] invalidQueryGroupingSettings() { return new String[] { - // Invalid max_groups: below minimum (0) - "{\n" + " \"persistent\" : {\n" + " \"search.insights.top_queries.max_groups\" : 0\n" + " }\n" + "}", + // Invalid max_groups: below minimum (-1) + "{\n" + + " \"persistent\" : {\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : -1\n" + + " }\n" + + "}", // Invalid max_groups: above maximum (10001) - "{\n" + " \"persistent\" : {\n" + " \"search.insights.top_queries.max_groups\" : 10001\n" + " }\n" + "}", + "{\n" + + " \"persistent\" : {\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : 10001\n" + + " }\n" + + "}", // Invalid group_by: unsupported value "{\n" @@ -112,11 +120,19 @@ private String[] invalidQueryGroupingSettings() { private String[] validQueryGroupingSettings() { return new String[] { - // Valid max_groups: minimum value (1) - "{\n" + " \"persistent\" : {\n" + " \"search.insights.top_queries.max_groups\" : 1\n" + " }\n" + "}", + // Valid max_groups: minimum value (0) + "{\n" + + " \"persistent\" : {\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : 0\n" + + " }\n" + + "}", // Valid max_groups: maximum value (10000) - "{\n" + " \"persistent\" : {\n" + " \"search.insights.top_queries.max_groups\" : 10000\n" + " }\n" + "}", + "{\n" + + " \"persistent\" : {\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : 10000\n" + + " }\n" + + "}", // Valid group_by: supported value (SIMILARITY) "{\n" + " \"persistent\" : {\n" + " \"search.insights.top_queries.group_by\" : \"SIMILARITY\"\n" + " }\n" + "}" }; @@ -129,7 +145,7 @@ private String groupByNoneSettings() { + " \"search.insights.top_queries.latency.window_size\" : \"1m\",\n" + " \"search.insights.top_queries.latency.top_n_size\" : 100,\n" + " \"search.insights.top_queries.group_by\" : \"none\",\n" - + " \"search.insights.top_queries.max_groups\" : 5\n" + + " \"search.insights.top_queries.max_groups_excluding_topn\" : 5\n" + " }\n" + "}"; }