Skip to content
1 change: 1 addition & 0 deletions x-pack/plugin/logsdb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.internal-test-artifact' // needed to run logsdb rest tests in serverless

esplugin {
name = 'logsdb'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.core.Booleans;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.FeatureFlag;
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 @@ -26,18 +28,26 @@

public class LogsdbTestSuiteIT extends ESClientYamlSuiteTestCase {

private static final String USER = "test_admin";
private static final String USER = "x_pack_rest_user";
private static final String PASS = "x-pack-test-password";

@ClassRule
public static final ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("logsdb")
.distribution(DistributionType.DEFAULT)
.user(USER, PASS, "superuser", false)
.setting("xpack.security.autoconfiguration.enabled", "false")
.setting("xpack.license.self_generated.type", "trial")
.feature(FeatureFlag.DOC_VALUES_SKIPPER)
.build();
public static final ElasticsearchCluster cluster = createCluster();

private static ElasticsearchCluster createCluster() {
LocalClusterSpecBuilder<ElasticsearchCluster> clusterBuilder = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.setting("xpack.security.enabled", "true")
.user(USER, PASS)
.keystore("bootstrap.password", "x-pack-test-password")
.setting("xpack.license.self_generated.type", "trial")
.feature(FeatureFlag.DOC_VALUES_SKIPPER);
boolean setNodes = Booleans.parseBoolean(System.getProperty("yaml.rest.tests.set_num_nodes", "true"));
if (setNodes) {
clusterBuilder.nodes(1);
}
return clusterBuilder.build();
}

public LogsdbTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,20 @@ setup:
type: pattern_text

- do:
index:
bulk:
index: test
id: "1"
refresh: true
body:
"@timestamp": 2025-07-17T00:00:00Z

- do:
index:
index: test
id: "2"
body:
"foo": "Found 5 errors for service [cheddar1]"
"@timestamp": 2025-07-17T00:00:01Z

- do:
index:
index: test
id: "3"
body:
"foo": "[2020-08-18T00:58:56] Found 123 errors for service [cheddar1]"
"@timestamp": 2025-07-17T00:00:02Z

- do:
index:
index: test
id: "4"
body:
"foo": "Found some errors for cheddar data service"
"@timestamp": 2025-07-17T00:00:03Z

- do:
index:
index: test
id: "5"
body:
"foo": "Found 123 errors for service [gorgonzola-24]"
"@timestamp": 2025-07-17T00:00:04Z

- do:
indices.refresh: {}
- { "index": { "_id": "1" } }
- { "@timestamp": "2025-07-17T00:00:00Z" }
- { "index": { "_id": "2" } }
- { "@timestamp": "2025-07-17T00:00:01Z", "foo": "Found 5 errors for service [cheddar1]" }
- { "index": { "_id": "3" } }
- { "@timestamp": "2025-07-17T00:00:02Z", "foo": "[2020-08-18T00:58:56] Found 123 errors for service [cheddar1]" }
- { "index": { "_id": "4" } }
- { "@timestamp": "2025-07-17T00:00:03Z", "foo": "Found some errors for cheddar data service" }
- { "index": { "_id": "5" } }
- { "@timestamp": "2025-07-17T00:00:04Z", "foo": "Found 123 errors for service [gorgonzola-24]" }

---
Field caps:
Expand Down