Skip to content

Commit 13deaea

Browse files
committed
Tweak LogsdbTestSuiteIT and logsdb gradle build file
so that it can be included in serverless stateful qa module.
1 parent 3ed487c commit 13deaea

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

x-pack/plugin/logsdb/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ apply plugin: 'elasticsearch.internal-es-plugin'
1111
apply plugin: 'elasticsearch.internal-cluster-test'
1212
apply plugin: 'elasticsearch.internal-java-rest-test'
1313
apply plugin: 'elasticsearch.internal-yaml-rest-test'
14+
apply plugin: 'elasticsearch.internal-test-artifact' // needed to run logsdb rest tests in serverless
1415

1516
esplugin {
1617
name = 'logsdb'

x-pack/plugin/logsdb/src/yamlRestTest/java/org/elasticsearch/xpack/logsdb/LogsdbTestSuiteIT.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
import org.elasticsearch.common.settings.SecureString;
1515
import org.elasticsearch.common.settings.Settings;
1616
import org.elasticsearch.common.util.concurrent.ThreadContext;
17+
import org.elasticsearch.core.Booleans;
1718
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1819
import org.elasticsearch.test.cluster.FeatureFlag;
20+
import org.elasticsearch.test.cluster.local.LocalClusterSpecBuilder;
1921
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
2022
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
2123
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
@@ -26,19 +28,27 @@
2628

2729
public class LogsdbTestSuiteIT extends ESClientYamlSuiteTestCase {
2830

29-
private static final String USER = "test_admin";
31+
private static final String USER = "x_pack_rest_user";
3032
private static final String PASS = "x-pack-test-password";
3133

3234
@ClassRule
33-
public static final ElasticsearchCluster cluster = ElasticsearchCluster.local()
34-
.module("logsdb")
35-
.distribution(DistributionType.DEFAULT)
36-
.user(USER, PASS, "superuser", false)
37-
.setting("xpack.security.autoconfiguration.enabled", "false")
38-
.setting("xpack.license.self_generated.type", "trial")
39-
.feature(FeatureFlag.DOC_VALUES_SKIPPER)
40-
.feature(FeatureFlag.BINARY_DOC_VALUE_COMPRESSION)
41-
.build();
35+
public static final ElasticsearchCluster cluster = createCluster();
36+
37+
private static ElasticsearchCluster createCluster() {
38+
LocalClusterSpecBuilder<ElasticsearchCluster> clusterBuilder = ElasticsearchCluster.local()
39+
.distribution(DistributionType.DEFAULT)
40+
.setting("xpack.security.enabled", "true")
41+
.user(USER, PASS)
42+
.keystore("bootstrap.password", "x-pack-test-password")
43+
.setting("xpack.license.self_generated.type", "trial")
44+
.feature(FeatureFlag.DOC_VALUES_SKIPPER)
45+
.feature(FeatureFlag.BINARY_DOC_VALUE_COMPRESSION);
46+
boolean setNodes = Booleans.parseBoolean(System.getProperty("yaml.rest.tests.set_num_nodes", "true"));
47+
if (setNodes) {
48+
clusterBuilder.nodes(1);
49+
}
50+
return clusterBuilder.build();
51+
}
4252

4353
public LogsdbTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
4454
super(testCandidate);

0 commit comments

Comments
 (0)