Skip to content

Commit

Permalink
Migrate mapper-related modules to internal-*-rest-test (#117298)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkts authored Nov 23, 2024
1 parent 0d1979e commit 2b8e4e7
Show file tree
Hide file tree
Showing 19 changed files with 118 additions and 63 deletions.
10 changes: 2 additions & 8 deletions modules/mapper-extras/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

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

esplugin {
Expand All @@ -21,9 +21,3 @@ restResources {
include '_common', 'cluster', 'field_caps', 'nodes', 'indices', 'index', 'search', 'get'
}
}

if (buildParams.isSnapshotBuild() == false) {
tasks.named("test").configure {
systemProperty 'es.index_mode_feature_flag_registered', 'true'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

/** Runs yaml rest tests */
public class MapperExtrasClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
Expand All @@ -26,4 +28,12 @@ public MapperExtrasClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate t
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("mapper-extras").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
4 changes: 2 additions & 2 deletions modules/parent-join/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-cluster-test'

esplugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class ParentChildClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
public ParentChildClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
Expand All @@ -24,4 +26,12 @@ public ParentChildClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate te
public static Iterable<Object[]> parameters() throws Exception {
return createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("parent-join").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
4 changes: 2 additions & 2 deletions modules/percolator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-cluster-test'

esplugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class PercolatorClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
public PercolatorClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
Expand All @@ -24,4 +26,12 @@ public PercolatorClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate tes
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("percolator").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
9 changes: 6 additions & 3 deletions modules/reindex/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import org.elasticsearch.gradle.transform.UnzipTransform

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

esplugin {
Expand All @@ -32,7 +32,6 @@ testClusters.configureEach {
module ':modules:rest-root'
// Whitelist reindexing from the local node so we can test reindex-from-remote.
setting 'reindex.remote.whitelist', '127.0.0.1:*'
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")
}

dependencies {
Expand All @@ -41,6 +40,10 @@ dependencies {
// for parent/child testing
testImplementation project(':modules:parent-join')
testImplementation project(':modules:rest-root')

clusterModules project(':modules:lang-painless')
clusterModules project(':modules:parent-join')
clusterModules project(":modules:rest-root")
}

restResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.hamcrest.CoreMatchers.containsString;

public class ReindexWithoutContentIT extends ESRestTestCase {

public void testReindexMissingBody() throws IOException {
ResponseException responseException = expectThrows(
ResponseException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class ReindexClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
public ReindexClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
Expand All @@ -24,4 +26,18 @@ public ReindexClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCa
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("reindex")
.module("lang-painless")
.module("parent-join")
.module("rest-root")
.setting("reindex.remote.whitelist", "127.0.0.1:*")
.build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
10 changes: 2 additions & 8 deletions plugins/mapper-annotated-text/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

esplugin {
description 'The Mapper Annotated_text plugin adds support for text fields with markup used to inject annotation tokens into the index.'
classname 'org.elasticsearch.index.mapper.annotatedtext.AnnotatedTextPlugin'
}

if (buildParams.isSnapshotBuild() == false) {
tasks.named("test").configure {
systemProperty 'es.index_mode_feature_flag_registered', 'true'
}
}

restResources {
restApi {
include '_common', 'indices', 'index', 'search'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class AnnotatedTextClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

Expand All @@ -25,4 +27,12 @@ public AnnotatedTextClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate
public static Iterable<Object[]> parameters() throws Exception {
return createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().plugin("mapper-annotated-text").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
16 changes: 3 additions & 13 deletions plugins/mapper-murmur3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

esplugin {
description 'The Mapper Murmur3 plugin allows to compute hashes of a field\'s values at index-time and to store them in the index.'
Expand All @@ -18,21 +18,11 @@ esplugin {
dependencies {
compileOnly project(':modules:lang-painless:spi')
testImplementation project(':modules:lang-painless')
}

if (buildParams.isSnapshotBuild() == false) {
tasks.named("test").configure {
systemProperty 'es.index_mode_feature_flag_registered', 'true'
}
clusterModules project(':modules:lang-painless')
}

restResources {
restApi {
include '_common', 'indices', 'index', 'search'
}
}

testClusters.configureEach {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'false'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class MapperMurmur3ClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

Expand All @@ -25,4 +27,12 @@ public MapperMurmur3ClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate
public static Iterable<Object[]> parameters() throws Exception {
return createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("lang-painless").plugin("mapper-murmur3").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
14 changes: 2 additions & 12 deletions x-pack/plugin/mapper-unsigned-long/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import org.elasticsearch.gradle.Version
evaluationDependsOn(xpackModule('core'))

apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

esplugin {
name 'unsigned-long'
Expand All @@ -35,13 +35,3 @@ restResources {
include '_common', 'bulk', 'indices', 'index', 'search', 'xpack'
}
}

if (buildParams.isSnapshotBuild() == false) {
tasks.named("test").configure {
systemProperty 'es.index_mode_feature_flag_registered', 'true'
}
}

testClusters.configureEach {
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

/** Runs yaml rest tests */
public class UnsignedLongClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
Expand All @@ -24,4 +26,12 @@ public UnsignedLongClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate t
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("unsigned-long").build();

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
9 changes: 2 additions & 7 deletions x-pack/plugin/mapper-version/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
evaluationDependsOn(xpackModule('core'))

apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'
apply plugin: 'elasticsearch.internal-cluster-test'

esplugin {
Expand All @@ -29,8 +29,3 @@ dependencies {
testImplementation project(path: xpackModule('analytics'))
}

if (buildParams.isSnapshotBuild() == false) {
tasks.named("test").configure {
systemProperty 'es.index_mode_feature_flag_registered', 'true'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

/** Runs yaml rest tests */
public class VersionClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
Expand All @@ -24,4 +26,12 @@ public VersionClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCa
public static Iterable<Object[]> parameters() throws Exception {
return ESClientYamlSuiteTestCase.createParameters();
}

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("mapper-version").build();

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

0 comments on commit 2b8e4e7

Please sign in to comment.