Skip to content

Commit

Permalink
Fix ClusterShardLimitIT
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Sep 2, 2023
1 parent b1c0bce commit 20df770
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -611,6 +611,7 @@ public void testOpenIndexOverLimit() {
public void testIgnoreDotSettingOnMultipleNodes() throws IOException, InterruptedException {
int maxAllowedShardsPerNode = 10, indexPrimaryShards = 11, indexReplicaShards = 1;

this.nodeAttributeSettings = null;
InternalTestCluster cluster = new InternalTestCluster(
randomLong(),
createTempDir(),
Expand Down Expand Up @@ -647,6 +648,7 @@ public Path nodeConfigPath(int nodeOrdinal) {
);
cluster.beforeTest(random());

OpenSearchIntegTestCase.remoteStoreNodeAttributeCluster = cluster;
// Starting 3 ClusterManagerOnlyNode nodes
cluster.startClusterManagerOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", true).build());
cluster.startClusterManagerOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", false).build());
Expand All @@ -655,6 +657,7 @@ public Path nodeConfigPath(int nodeOrdinal) {
// Starting 2 data nodes
cluster.startDataOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", false).build());
cluster.startDataOnlyNode(Settings.builder().put("cluster.ignore_dot_indexes", false).build());
OpenSearchIntegTestCase.remoteStoreNodeAttributeCluster = null;

// Setting max shards per node to be 10
cluster.client()
Expand Down
Expand Up @@ -386,6 +386,8 @@ public abstract class OpenSearchIntegTestCase extends OpenSearchTestCase {
* By default if no {@link ClusterScope} is configured this will hold a reference to the suite cluster.
*/
private static TestCluster currentCluster;

public static TestCluster remoteStoreNodeAttributeCluster;
private static RestClient restClient = null;

private static final Map<Class<?>, TestCluster> clusters = new IdentityHashMap<>();
Expand Down Expand Up @@ -1889,7 +1891,7 @@ private int getNumClientNodes() {
return annotation == null ? InternalTestCluster.DEFAULT_NUM_CLIENT_NODES : annotation.numClientNodes();
}

Settings nodeAttributeSettings;
protected Settings nodeAttributeSettings;

/**
* This method is used to obtain settings for the {@code N}th node in the cluster.
Expand Down Expand Up @@ -2261,6 +2263,9 @@ 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 (remoteStoreNodeAttributeCluster != null) {
return randomRepoPath(((InternalTestCluster) remoteStoreNodeAttributeCluster).getDefaultSettings());
}
if (currentCluster instanceof InternalTestCluster) {
return randomRepoPath(((InternalTestCluster) currentCluster).getDefaultSettings());
}
Expand Down

0 comments on commit 20df770

Please sign in to comment.