Skip to content

Commit

Permalink
Remove IdentityService from RestController constructor (#736)
Browse files Browse the repository at this point in the history
* Remove IdentityService from RestController constructor

Signed-off-by: Craig Perkins <[email protected]>

* Upgrade bwc version

Signed-off-by: Craig Perkins <[email protected]>

---------

Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks authored Oct 23, 2024
1 parent ca521d5 commit c643111
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 25 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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<RegularFile>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -64,7 +63,6 @@ public class PerformanceAnalyzerPluginTests extends OpenSearchTestCase {
private CircuitBreakerService circuitBreakerService;
private ClusterService clusterService;
private ClusterSettings clusterSettings;
private IdentityService identityService;

private MetricsRegistry metricsRegistry;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -48,7 +46,6 @@ public class PerformanceAnalyzerConfigActionTests {
private NodeClient nodeClient;
private CircuitBreakerService circuitBreakerService;
private ClusterSettings clusterSettings;
private IdentityService identityService;

@Mock private PerformanceAnalyzerController controller;

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit c643111

Please sign in to comment.