From 43178d3f9d21b1b85d118e17143778c0f4ad3a6e Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Wed, 22 May 2024 11:04:05 +0800 Subject: [PATCH] Update tests to disable apm-data where needed --- .../datastreams/LogsDataStreamIT.java | 36 ++++++++++++++++++- .../qa/native-multi-node-tests/build.gradle | 1 + 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/LogsDataStreamIT.java b/modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/LogsDataStreamIT.java index 79d33a95c4709..c2a7a76ab751a 100644 --- a/modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/LogsDataStreamIT.java +++ b/modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/LogsDataStreamIT.java @@ -11,8 +11,16 @@ import org.elasticsearch.client.Request; import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.RestClient; +import org.elasticsearch.common.settings.SecureString; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.elasticsearch.test.cluster.ElasticsearchCluster; +import org.elasticsearch.test.cluster.FeatureFlag; +import org.elasticsearch.test.cluster.local.distribution.DistributionType; +import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.After; import org.junit.Before; +import org.junit.ClassRule; import java.io.IOException; import java.util.List; @@ -27,7 +35,33 @@ import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; -public class LogsDataStreamIT extends DisabledSecurityDataStreamTestCase { +public class LogsDataStreamIT extends ESRestTestCase { + + @ClassRule + public static ElasticsearchCluster cluster = ElasticsearchCluster.local() + .distribution(DistributionType.DEFAULT) + .feature(FeatureFlag.FAILURE_STORE_ENABLED) + .setting("xpack.security.enabled", "false") + .setting("xpack.watcher.enabled", "false") + // Disable apm-data so the index templates it installs do not impact + // tests such as testIgnoreDynamicBeyondLimit. + .setting("xpack.apm_data.enabled", "false") + .build(); + + @Override + protected String getTestRestCluster() { + return cluster.getHttpAddresses(); + } + + @Override + protected Settings restAdminSettings() { + if (super.restAdminSettings().keySet().contains(ThreadContext.PREFIX + ".Authorization")) { + return super.restAdminSettings(); + } else { + String token = basicAuthHeaderValue("admin", new SecureString("admin-password".toCharArray())); + return Settings.builder().put(super.restAdminSettings()).put(ThreadContext.PREFIX + ".Authorization", token).build(); + } + } private RestClient client; diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index 055561c747a63..eb1f9b9671bdc 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -57,6 +57,7 @@ testClusters.configureEach { setting 'slm.history_index_enabled', 'false' setting 'stack.templates.enabled', 'false' setting 'xpack.ent_search.enabled', 'false' + setting 'xpack.apm_data.enabled', 'false' // To spice things up a bit, one of the nodes is not an ML node nodes.'javaRestTest-0'.setting 'node.roles', '["master","data","ingest"]' nodes.'javaRestTest-1'.setting 'node.roles', '["master","data","ingest","ml"]'