Skip to content

Commit

Permalink
Updating data streams module to use new rest test framework (#99391)
Browse files Browse the repository at this point in the history
  • Loading branch information
masseyke authored Sep 12, 2023
1 parent b2f4534 commit 8685c8a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
21 changes: 4 additions & 17 deletions modules/data-streams/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import org.elasticsearch.gradle.internal.info.BuildParams

apply plugin: 'elasticsearch.test-with-dependencies'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

esplugin {
description 'Elasticsearch Expanded Pack Plugin - Data Streams'
Expand All @@ -22,27 +22,14 @@ dependencies {
testImplementation project(path: ':test:test-clusters')
}

testClusters.configureEach {
module ':modules:reindex'
testDistribution = 'DEFAULT'
// disable ILM history, since it disturbs tests using _all
setting 'indices.lifecycle.history_index_enabled', 'false'
setting 'xpack.security.enabled', 'true'
keystore 'bootstrap.password', 'x-pack-test-password'
user username: "x_pack_rest_user", password: "x-pack-test-password"
tasks.named('yamlRestTest') {
usesDefaultDistribution()
}

tasks.named('javaRestTest') {
usesDefaultDistribution()
}

testClusters.matching { it.name == "javaRestTest" }.configureEach {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'false'
// disable ILM history, since it disturbs tests using _all
setting 'indices.lifecycle.history_index_enabled', 'false'
}

if (BuildParams.inFipsJvm){
// These fail in CI but only when run as part of checkPart2 and not individually.
// Tracked in :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
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.local.distribution.DistributionType;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class DataStreamsClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

Expand All @@ -33,4 +36,19 @@ protected Settings restClientSettings() {
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", BASIC_AUTH_VALUE).build();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.module("reindex")
.setting("indices.lifecycle.history_index_enabled", "false")
.setting("xpack.security.enabled", "true")
.keystore("bootstrap.password", "x-pack-test-password")
.user("x_pack_rest_user", "x-pack-test-password")
.build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}

}

0 comments on commit 8685c8a

Please sign in to comment.