Skip to content

Commit

Permalink
[Backport 2.x] Remove IdentityService from RestController constructor (
Browse files Browse the repository at this point in the history
…#737)

* Remove IdentityService from RestController constructor

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

* Sync with 2.x

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

* Fix docker issue

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

---------

Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks authored Oct 23, 2024
1 parent d05633b commit bd6833f
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
# Explicitly set the docker-compose program path so that our build scripts in RCA can run the program
# This is necessary because of the Github Actions environment and the workingDir of the Gradle environment
- name: Set docker-compose path
run: DOCKER_COMPOSE_LOCATION=$(which docker-compose)
run: echo "DOCKER_COMPOSE_LOCATION=$(which docker-compose)" >> $GITHUB_ENV
# Set the vm.max_map_count system property to the minimum required to run OpenSearch
- name: Set vm.max_map_count
run: sudo sysctl -w vm.max_map_count=262144
Expand Down
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.17.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.17.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 bd6833f

Please sign in to comment.