From d971db6823099e3a3443175d1a4be92c11a0b124 Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Wed, 23 Oct 2024 01:05:32 -0400 Subject: [PATCH] Remove IdentityService from RestController constructor (#736) * Remove IdentityService from RestController constructor Signed-off-by: Craig Perkins * Upgrade bwc version Signed-off-by: Craig Perkins --------- Signed-off-by: Craig Perkins (cherry picked from commit c643111d76f63eadd5fe1196844f96a84df530bb) --- build.gradle | 4 ++-- .../PerformanceAnalyzerPluginTests.java | 6 +----- .../PerformanceAnalyzerClusterConfigActionTests.java | 7 +------ .../config/PerformanceAnalyzerConfigActionTests.java | 7 +------ ...rformanceAnalyzerOverridesClusterConfigActionTests.java | 7 +------ 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index 3c8c629d..0a128f2c 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ buildscript { isSnapshot = "true" == System.getProperty("build.snapshot", "true") buildVersionQualifier = System.getProperty("build.version_qualifier", "") - default_bwc_version = System.getProperty("bwc.version", "2.12.0.0") + default_bwc_version = System.getProperty("bwc.version", "2.18.0.0") pa_bwc_version = System.getProperty("tests.bwc.version", default_bwc_version) baseName = "paBwcCluster" @@ -669,7 +669,7 @@ task integTestRemote(type: RestIntegTestTask) { testClusters { "${baseName}$i" { testDistribution = "ARCHIVE" - versions = ["2.12.0-SNAPSHOT", opensearch_version] + versions = ["2.18.0-SNAPSHOT", opensearch_version] numberOfNodes = 3 plugin(provider(new Callable() { @Override diff --git a/src/test/java/org/opensearch/performanceanalyzer/PerformanceAnalyzerPluginTests.java b/src/test/java/org/opensearch/performanceanalyzer/PerformanceAnalyzerPluginTests.java index cf7dd703..074267fb 100644 --- a/src/test/java/org/opensearch/performanceanalyzer/PerformanceAnalyzerPluginTests.java +++ b/src/test/java/org/opensearch/performanceanalyzer/PerformanceAnalyzerPluginTests.java @@ -30,7 +30,6 @@ import org.opensearch.core.indices.breaker.CircuitBreakerService; import org.opensearch.env.Environment; import org.opensearch.env.TestEnvironment; -import org.opensearch.identity.IdentityService; import org.opensearch.indices.breaker.BreakerSettings; import org.opensearch.indices.breaker.HierarchyCircuitBreakerService; import org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionFilter; @@ -64,7 +63,6 @@ public class PerformanceAnalyzerPluginTests extends OpenSearchTestCase { private CircuitBreakerService circuitBreakerService; private ClusterService clusterService; private ClusterSettings clusterSettings; - private IdentityService identityService; private MetricsRegistry metricsRegistry; @@ -90,15 +88,13 @@ public void setup() { e.printStackTrace(); } clusterService = new ClusterService(settings, clusterSettings, threadPool); - identityService = new IdentityService(Settings.EMPTY, threadPool, List.of()); restController = new RestController( Collections.emptySet(), null, nodeClient, circuitBreakerService, - usageService, - identityService); + usageService); } @After diff --git a/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerClusterConfigActionTests.java b/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerClusterConfigActionTests.java index 544d86e7..49cd687f 100644 --- a/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerClusterConfigActionTests.java +++ b/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerClusterConfigActionTests.java @@ -12,7 +12,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; -import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -28,7 +27,6 @@ import org.opensearch.core.rest.RestStatus; import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.core.xcontent.XContentBuilder; -import org.opensearch.identity.IdentityService; import org.opensearch.indices.breaker.BreakerSettings; import org.opensearch.indices.breaker.HierarchyCircuitBreakerService; import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; @@ -54,7 +52,6 @@ public class PerformanceAnalyzerClusterConfigActionTests { private PerformanceAnalyzerClusterSettingHandler clusterSettingHandler; private NodeStatsSettingHandler nodeStatsSettingHandler; private PerformanceAnalyzerCollectorsSettingHandler performanceAnalyzerCollectorsSettingHandler; - private IdentityService identityService; @Mock private PerformanceAnalyzerController controller; @Mock private ClusterSettingsManager clusterSettingsManager; @@ -71,15 +68,13 @@ public void init() { UsageService usageService = new UsageService(); threadPool = new TestThreadPool("test"); nodeClient = new NodeClient(Settings.EMPTY, threadPool); - identityService = new IdentityService(Settings.EMPTY, threadPool, List.of()); restController = new RestController( Collections.emptySet(), null, nodeClient, circuitBreakerService, - usageService, - identityService); + usageService); clusterSettingHandler = new PerformanceAnalyzerClusterSettingHandler(controller, clusterSettingsManager); nodeStatsSettingHandler = new NodeStatsSettingHandler(controller, clusterSettingsManager); diff --git a/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerConfigActionTests.java b/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerConfigActionTests.java index c8dbec4e..80b6b3b8 100644 --- a/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerConfigActionTests.java +++ b/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerConfigActionTests.java @@ -12,7 +12,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; -import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -29,7 +28,6 @@ import org.opensearch.core.rest.RestStatus; import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.core.xcontent.XContentBuilder; -import org.opensearch.identity.IdentityService; import org.opensearch.indices.breaker.BreakerSettings; import org.opensearch.indices.breaker.HierarchyCircuitBreakerService; import org.opensearch.performanceanalyzer.config.PerformanceAnalyzerController; @@ -48,7 +46,6 @@ public class PerformanceAnalyzerConfigActionTests { private NodeClient nodeClient; private CircuitBreakerService circuitBreakerService; private ClusterSettings clusterSettings; - private IdentityService identityService; @Mock private PerformanceAnalyzerController controller; @@ -64,15 +61,13 @@ public void init() { UsageService usageService = new UsageService(); threadPool = new TestThreadPool("test"); nodeClient = new NodeClient(Settings.EMPTY, threadPool); - identityService = new IdentityService(Settings.EMPTY, threadPool, List.of()); restController = new RestController( Collections.emptySet(), null, nodeClient, circuitBreakerService, - usageService, - identityService); + usageService); configAction = new PerformanceAnalyzerConfigAction(restController, controller); restController.registerHandler(configAction); diff --git a/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerOverridesClusterConfigActionTests.java b/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerOverridesClusterConfigActionTests.java index 16adf381..e5e43658 100644 --- a/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerOverridesClusterConfigActionTests.java +++ b/src/test/java/org/opensearch/performanceanalyzer/http_action/config/PerformanceAnalyzerOverridesClusterConfigActionTests.java @@ -13,7 +13,6 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; -import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -27,7 +26,6 @@ import org.opensearch.core.indices.breaker.CircuitBreakerService; import org.opensearch.core.rest.RestStatus; import org.opensearch.core.xcontent.NamedXContentRegistry; -import org.opensearch.identity.IdentityService; import org.opensearch.indices.breaker.BreakerSettings; import org.opensearch.indices.breaker.HierarchyCircuitBreakerService; import org.opensearch.performanceanalyzer.commons.config.overrides.ConfigOverridesWrapper; @@ -48,7 +46,6 @@ public class PerformanceAnalyzerOverridesClusterConfigActionTests { private NodeClient nodeClient; private CircuitBreakerService circuitBreakerService; private ClusterSettings clusterSettings; - private IdentityService identityService; @Mock private ConfigOverridesClusterSettingHandler configOverridesClusterSettingHandler; @Mock private ConfigOverridesWrapper overridesWrapper; @@ -65,15 +62,13 @@ public void init() { UsageService usageService = new UsageService(); threadPool = new TestThreadPool("test"); nodeClient = new NodeClient(Settings.EMPTY, threadPool); - identityService = new IdentityService(Settings.EMPTY, threadPool, List.of()); restController = new RestController( Collections.emptySet(), null, nodeClient, circuitBreakerService, - usageService, - identityService); + usageService); configAction = new PerformanceAnalyzerOverridesClusterConfigAction( Settings.EMPTY,