Skip to content

Commit

Permalink
Not setting number of nodes if a systsem property is false
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke committed Sep 25, 2023
1 parent 70277a0 commit 46f9d57
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.local.LocalClusterSpecBuilder;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
Expand All @@ -37,14 +38,20 @@ protected Settings restClientSettings() {
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.nodes(2)
.setting("indices.lifecycle.history_index_enabled", "false")
.setting("xpack.security.enabled", "true")
.keystore("bootstrap.password", "x-pack-test-password")
.user("x_pack_rest_user", "x-pack-test-password")
.build();
public static ElasticsearchCluster cluster = createCluster();

private static ElasticsearchCluster createCluster() {
LocalClusterSpecBuilder<ElasticsearchCluster> clusterBuilder = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.setting("xpack.security.enabled", "true")
.keystore("bootstrap.password", "x-pack-test-password")
.user("x_pack_rest_user", "x-pack-test-password");
boolean setNodes = Boolean.parseBoolean(System.getProperty("yaml.rest.tests.set_num_nodes", "true"));
if (setNodes) {
clusterBuilder.nodes(2);
}
return clusterBuilder.build();
}

@Override
protected String getTestRestCluster() {
Expand Down

0 comments on commit 46f9d57

Please sign in to comment.