Skip to content

Commit

Permalink
Update tests to disable apm-data where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
axw committed May 22, 2024
1 parent f920cdb commit 43178d3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
Expand Down

0 comments on commit 43178d3

Please sign in to comment.