From 886ca2f19f96c8926e82547da39d85cf1124a786 Mon Sep 17 00:00:00 2001 From: Siddhant Deshmukh Date: Wed, 28 Aug 2024 13:26:30 -0700 Subject: [PATCH] Fix tests and spotless apply Signed-off-by: Siddhant Deshmukh --- .../core/listener/QueryInsightsListener.java | 2 +- .../core/service/QueryInsightsService.java | 1 - .../service/QueryInsightsServiceTests.java | 20 ------------------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java b/src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java index cc5f2a13..f7955043 100644 --- a/src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java +++ b/src/main/java/org/opensearch/plugin/insights/core/listener/QueryInsightsListener.java @@ -8,8 +8,8 @@ package org.opensearch.plugin.insights.core.listener; -import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.TOP_N_QUERIES_GROUP_BY; import static org.opensearch.plugin.insights.settings.QueryCategorizationSettings.SEARCH_QUERY_METRICS_ENABLED_SETTING; +import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.TOP_N_QUERIES_GROUP_BY; import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.getTopNEnabledSetting; import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.getTopNSizeSetting; import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.getTopNWindowSizeSetting; diff --git a/src/main/java/org/opensearch/plugin/insights/core/service/QueryInsightsService.java b/src/main/java/org/opensearch/plugin/insights/core/service/QueryInsightsService.java index 52fb591f..d17620cf 100644 --- a/src/main/java/org/opensearch/plugin/insights/core/service/QueryInsightsService.java +++ b/src/main/java/org/opensearch/plugin/insights/core/service/QueryInsightsService.java @@ -8,7 +8,6 @@ package org.opensearch.plugin.insights.core.service; -import static org.opensearch.plugin.insights.settings.QueryCategorizationSettings.SEARCH_QUERY_METRICS_ENABLED_SETTING; import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.DEFAULT_GROUPING_TYPE; import static org.opensearch.plugin.insights.settings.QueryInsightsSettings.getExporterSettings; diff --git a/src/test/java/org/opensearch/plugin/insights/core/service/QueryInsightsServiceTests.java b/src/test/java/org/opensearch/plugin/insights/core/service/QueryInsightsServiceTests.java index ce4d4eb0..e0fb47dd 100644 --- a/src/test/java/org/opensearch/plugin/insights/core/service/QueryInsightsServiceTests.java +++ b/src/test/java/org/opensearch/plugin/insights/core/service/QueryInsightsServiceTests.java @@ -90,26 +90,6 @@ public void testSearchQueryMetricsEnabled() { } - public void testFeaturesEnableDisable() { - // Test case 1: All metric type collection disabled and search query metrics disabled, enable search query metrics - queryInsightsServiceSpy.enableCollection(MetricType.LATENCY, false); - queryInsightsServiceSpy.enableCollection(MetricType.CPU, false); - queryInsightsServiceSpy.enableCollection(MetricType.MEMORY, false); - queryInsightsServiceSpy.setSearchQueryMetricsEnabled(false); - - queryInsightsServiceSpy.setSearchQueryMetricsEnabled(true); - verify(queryInsightsServiceSpy).checkAndRestartQueryInsights(); - - // Test case 2: All metric type collection disabled and search query metrics enabled, disable search query metrics - queryInsightsServiceSpy.enableCollection(MetricType.LATENCY, false); - queryInsightsServiceSpy.enableCollection(MetricType.CPU, false); - queryInsightsServiceSpy.enableCollection(MetricType.MEMORY, false); - queryInsightsServiceSpy.setSearchQueryMetricsEnabled(true); - - queryInsightsServiceSpy.setSearchQueryMetricsEnabled(false); - verify(queryInsightsServiceSpy).checkAndStopQueryInsights(); - } - public void testAddRecordGroupBySimilarityWithDifferentGroups() { int numberOfRecordsRequired = 10;