Skip to content

Commit 5a97891

Browse files
authored
Tweak LogsdbTestSuiteIT and logsdb gradle build file (#138575)
so that it can be included in serverless stateful qa module.
1 parent 1768bc7 commit 5a97891

File tree

3 files changed

+32
-47
lines changed

3 files changed

+32
-47
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: 19 additions & 9 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,18 +28,26 @@
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-
.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+
boolean setNodes = Booleans.parseBoolean(System.getProperty("yaml.rest.tests.set_num_nodes", "true"));
46+
if (setNodes) {
47+
clusterBuilder.nodes(1);
48+
}
49+
return clusterBuilder.build();
50+
}
4151

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

x-pack/plugin/logsdb/src/yamlRestTest/resources/rest-api-spec/test/patterntext/30_template_id.yml

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,20 @@ setup:
1818
type: pattern_text
1919

2020
- do:
21-
index:
21+
bulk:
2222
index: test
23-
id: "1"
23+
refresh: true
2424
body:
25-
"@timestamp": 2025-07-17T00:00:00Z
26-
27-
- do:
28-
index:
29-
index: test
30-
id: "2"
31-
body:
32-
"foo": "Found 5 errors for service [cheddar1]"
33-
"@timestamp": 2025-07-17T00:00:01Z
34-
35-
- do:
36-
index:
37-
index: test
38-
id: "3"
39-
body:
40-
"foo": "[2020-08-18T00:58:56] Found 123 errors for service [cheddar1]"
41-
"@timestamp": 2025-07-17T00:00:02Z
42-
43-
- do:
44-
index:
45-
index: test
46-
id: "4"
47-
body:
48-
"foo": "Found some errors for cheddar data service"
49-
"@timestamp": 2025-07-17T00:00:03Z
50-
51-
- do:
52-
index:
53-
index: test
54-
id: "5"
55-
body:
56-
"foo": "Found 123 errors for service [gorgonzola-24]"
57-
"@timestamp": 2025-07-17T00:00:04Z
58-
59-
- do:
60-
indices.refresh: {}
25+
- { "index": { "_id": "1" } }
26+
- { "@timestamp": "2025-07-17T00:00:00Z" }
27+
- { "index": { "_id": "2" } }
28+
- { "@timestamp": "2025-07-17T00:00:01Z", "foo": "Found 5 errors for service [cheddar1]" }
29+
- { "index": { "_id": "3" } }
30+
- { "@timestamp": "2025-07-17T00:00:02Z", "foo": "[2020-08-18T00:58:56] Found 123 errors for service [cheddar1]" }
31+
- { "index": { "_id": "4" } }
32+
- { "@timestamp": "2025-07-17T00:00:03Z", "foo": "Found some errors for cheddar data service" }
33+
- { "index": { "_id": "5" } }
34+
- { "@timestamp": "2025-07-17T00:00:04Z", "foo": "Found 123 errors for service [gorgonzola-24]" }
6135

6236
---
6337
Field caps:

0 commit comments

Comments
 (0)