Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed Jan 17, 2024
1 parent 26f313f commit e38f383
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public static Client client() {
}

public static Client client(@Nullable String node) {
return testClusterRule.client(node);
return testClusterRule.clientForNode(node);
}

public static Client dataNodeClient() {
Expand Down Expand Up @@ -2122,7 +2122,7 @@ public <T extends TransportRequest> TransportRequestHandler<T> interceptHandler(
* Returns path to a random directory that can be used to create a temporary file system repo
*/
public Path randomRepoPath() {
if (cluster() instanceof InternalTestCluster) {
if (isInternalCluster()) {
return randomRepoPath(((InternalTestCluster) cluster()).getDefaultSettings());
}
throw new UnsupportedOperationException("unsupported cluster type");
Expand Down Expand Up @@ -2233,7 +2233,7 @@ protected boolean forbidPrivateIndexSettings() {
* The returned client gets automatically closed when needed, it shouldn't be closed as part of tests otherwise
* it cannot be reused by other tests anymore.
*/
protected static synchronized RestClient getRestClient() {
protected static RestClient getRestClient() {
return testClusterRule.getRestClient();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ InternalTestCluster internalCluster() {
return (InternalTestCluster) cluster();
}

Client client() {
return client(null);
Client clientForAnyNode() {
return clientForNode(null);
}

Client client(@Nullable String node) {
Client clientForNode(@Nullable String node) {
if (node != null) {
return internalCluster().client(node);
}
Expand Down Expand Up @@ -186,7 +186,7 @@ protected RestClient createRestClient() {
}

protected RestClient createRestClient(RestClientBuilder.HttpClientConfigCallback httpClientConfigCallback, String protocol) {
NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().get();
NodesInfoResponse nodesInfoResponse = clientForAnyNode().admin().cluster().prepareNodesInfo().get();
assertFalse(nodesInfoResponse.hasFailures());
return createRestClient(nodesInfoResponse.getNodes(), httpClientConfigCallback, protocol);
}
Expand Down Expand Up @@ -282,7 +282,7 @@ private void afterInternal(boolean afterClass, OpenSearchIntegTestCase target) t
try {
if (cluster() != null) {
if (currentClusterScope != Scope.TEST) {
Metadata metadata = client().admin().cluster().prepareState().execute().actionGet().getState().getMetadata();
Metadata metadata = clientForAnyNode().admin().cluster().prepareState().execute().actionGet().getState().getMetadata();

final Set<String> persistentKeys = new HashSet<>(metadata.persistentSettings().keySet());
assertThat("test leaves persistent cluster metadata behind", persistentKeys, empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
*
* If the test suites use per-test level, the cluster will be recreated per each test method (applying static or dynamic settings).
*/
public abstract class ParameterizedOpenSearchIntegTestCase extends OpenSearchIntegTestCase {
abstract class ParameterizedOpenSearchIntegTestCase extends OpenSearchIntegTestCase {
protected final Settings settings;

public ParameterizedOpenSearchIntegTestCase(Settings settings) {
ParameterizedOpenSearchIntegTestCase(Settings settings) {
this.settings = settings;
}

Expand Down

0 comments on commit e38f383

Please sign in to comment.