diff --git a/x-pack/plugin/logsdb/build.gradle b/x-pack/plugin/logsdb/build.gradle index 81f0fe15abe53..88e429e3fab96 100644 --- a/x-pack/plugin/logsdb/build.gradle +++ b/x-pack/plugin/logsdb/build.gradle @@ -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' diff --git a/x-pack/plugin/logsdb/src/yamlRestTest/java/org/elasticsearch/xpack/logsdb/LogsdbTestSuiteIT.java b/x-pack/plugin/logsdb/src/yamlRestTest/java/org/elasticsearch/xpack/logsdb/LogsdbTestSuiteIT.java index 5a1ccb4e08140..1c9f3f5fb5a21 100644 --- a/x-pack/plugin/logsdb/src/yamlRestTest/java/org/elasticsearch/xpack/logsdb/LogsdbTestSuiteIT.java +++ b/x-pack/plugin/logsdb/src/yamlRestTest/java/org/elasticsearch/xpack/logsdb/LogsdbTestSuiteIT.java @@ -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; @@ -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 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); diff --git a/x-pack/plugin/logsdb/src/yamlRestTest/resources/rest-api-spec/test/patterntext/30_template_id.yml b/x-pack/plugin/logsdb/src/yamlRestTest/resources/rest-api-spec/test/patterntext/30_template_id.yml index d8c6528bc5892..e51a859323c71 100644 --- a/x-pack/plugin/logsdb/src/yamlRestTest/resources/rest-api-spec/test/patterntext/30_template_id.yml +++ b/x-pack/plugin/logsdb/src/yamlRestTest/resources/rest-api-spec/test/patterntext/30_template_id.yml @@ -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: