Skip to content

Commit d06905c

Browse files
mark-vieiraomricohenn
authored andcommitted
Convert :test projects to new testing framework (elastic#125724)
1 parent 2818cdd commit d06905c

File tree

9 files changed

+57
-28
lines changed

9 files changed

+57
-28
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
3636
map.put(LegacyRestTestBasePlugin.class, ":qa:remote-clusters");
3737
map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version");
3838
map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade-legacy");
39-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-apm-integration");
40-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-delayed-aggs");
41-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-die-with-dignity");
42-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-error-query");
43-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-latency-simulating-directory");
44-
map.put(LegacyRestTestBasePlugin.class, ":test:yaml-rest-runner");
4539
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core");
4640
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
4741
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
@@ -60,8 +54,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
6054
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-plugins-ssl");
6155
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-security-with-mustache");
6256
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:xpack-prefix-rest-compat");
63-
map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-geoip:qa:file-based-update");
64-
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce:qa:gce");
6557
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-basic-license");
6658
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-full-license");
6759
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-restricted-trust");

test/external-modules/delayed-aggs/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
11-
12-
tasks.named('yamlRestTest').configure {
13-
it.onlyIf("snapshot build") { buildParams.snapshotBuild }
14-
}
10+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
1511

1612
esplugin {
1713
description = 'A test module that allows to delay aggregations on shards with a configurable time'
@@ -23,3 +19,8 @@ restResources {
2319
include '_common', 'indices', 'index', 'cluster', 'search'
2420
}
2521
}
22+
23+
tasks.named('yamlRestTest') {
24+
def isSnapshot = buildParams.snapshotBuild
25+
it.onlyIf("snapshot build") { isSnapshot }
26+
}

test/external-modules/delayed-aggs/src/yamlRestTest/java/org/elasticsearch/search/aggregations/DelayedShardAggregationClientYamlTestSuiteIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1414

15+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1516
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
1617
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
18+
import org.junit.ClassRule;
1719

1820
public class DelayedShardAggregationClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
21+
22+
@ClassRule
23+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("test-delayed-aggs").build();
24+
1925
public DelayedShardAggregationClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
2026
super(testCandidate);
2127
}
@@ -24,4 +30,9 @@ public DelayedShardAggregationClientYamlTestSuiteIT(@Name("yaml") ClientYamlTest
2430
public static Iterable<Object[]> parameters() throws Exception {
2531
return ESClientYamlSuiteTestCase.createParameters();
2632
}
33+
34+
@Override
35+
protected String getTestRestCluster() {
36+
return cluster.getHttpAddresses();
37+
}
2738
}

test/external-modules/error-query/build.gradle

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,10 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
11-
apply plugin: 'elasticsearch.internal-java-rest-test'
12-
13-
tasks.named('javaRestTest') {
14-
usesDefaultDistribution("to be triaged")
15-
it.onlyIf("snapshot build") { buildParams.snapshotBuild }
16-
}
10+
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
1711

18-
tasks.named('yamlRestTest').configure {
19-
it.onlyIf("snapshot build") { buildParams.snapshotBuild }
20-
}
12+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
13+
apply plugin: 'elasticsearch.internal-java-rest-test'
2114

2215
esplugin {
2316
description = 'A test module that exposes a way to simulate search shard failures and warnings'
@@ -29,3 +22,14 @@ restResources {
2922
include '_common', 'indices', 'index', 'cluster', 'search'
3023
}
3124
}
25+
26+
dependencies {
27+
clusterModules project(':x-pack:plugin:esql')
28+
clusterModules project(':x-pack:plugin:autoscaling')
29+
clusterModules project(':x-pack:plugin:ilm')
30+
}
31+
32+
tasks.withType(StandaloneRestIntegTestTask) {
33+
def isSnapshot = buildParams.snapshotBuild
34+
onlyIf("snapshot build") { isSnapshot }
35+
}

test/external-modules/error-query/src/javaRestTest/java/org/elasticsearch/test/esql/EsqlPartialResultsIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import org.elasticsearch.common.settings.Settings;
1717
import org.elasticsearch.common.xcontent.support.XContentMapValues;
1818
import org.elasticsearch.test.cluster.ElasticsearchCluster;
19-
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
2019
import org.elasticsearch.test.rest.ESRestTestCase;
2120
import org.junit.ClassRule;
2221

@@ -35,8 +34,9 @@
3534
public class EsqlPartialResultsIT extends ESRestTestCase {
3635
@ClassRule
3736
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
38-
.distribution(DistributionType.DEFAULT)
3937
.module("test-error-query")
38+
.module("x-pack-esql")
39+
.module("x-pack-ilm")
4040
.setting("xpack.security.enabled", "false")
4141
.setting("xpack.license.self_generated.type", "trial")
4242
.setting("esql.query.allow_partial_results", "true")

test/external-modules/error-query/src/yamlRestTest/java/org/elasticsearch/search/query/ErrorQueryClientYamlTestSuiteIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1414

15+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1516
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
1617
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
18+
import org.junit.ClassRule;
1719

1820
public class ErrorQueryClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {
21+
22+
@ClassRule
23+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().module("test-error-query").build();
24+
1925
public ErrorQueryClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
2026
super(testCandidate);
2127
}
@@ -24,4 +30,9 @@ public ErrorQueryClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate tes
2430
public static Iterable<Object[]> parameters() throws Exception {
2531
return ESClientYamlSuiteTestCase.createParameters();
2632
}
33+
34+
@Override
35+
protected String getTestRestCluster() {
36+
return cluster.getHttpAddresses();
37+
}
2738
}

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/DefaultLocalClusterHandle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class DefaultLocalClusterHandle implements LocalClusterHandle {
4141
public static final AtomicInteger NEXT_DEBUG_PORT = new AtomicInteger(5007);
4242

4343
private static final Logger LOGGER = LogManager.getLogger(DefaultLocalClusterHandle.class);
44-
private static final Duration CLUSTER_UP_TIMEOUT = Duration.ofMinutes(5);
44+
private static final Duration CLUSTER_UP_TIMEOUT = Duration.ofMinutes(1);
4545

4646
public final ForkJoinPool executor = new ForkJoinPool(
4747
Math.max(Runtime.getRuntime().availableProcessors(), 4),

test/yaml-rest-runner/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'elasticsearch.build'
2-
apply plugin: 'elasticsearch.legacy-yaml-rest-test'
3-
apply plugin: 'elasticsearch.legacy-yaml-rest-compat-test'
2+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
3+
apply plugin: 'elasticsearch.yaml-rest-compat-test'
44

55
dependencies {
66
api project(':test:framework')

test/yaml-rest-runner/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/ESClientYamlSuiteTestCaseFailLogIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@
1313

1414
import org.apache.logging.log4j.Level;
1515
import org.elasticsearch.test.MockLog;
16+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1617
import org.elasticsearch.test.junit.annotations.TestLogging;
18+
import org.junit.ClassRule;
1719

1820
import java.io.IOException;
1921

2022
public class ESClientYamlSuiteTestCaseFailLogIT extends ESClientYamlSuiteTestCase {
2123

24+
@ClassRule
25+
public static ElasticsearchCluster cluster = ElasticsearchCluster.local().build();
26+
2227
public ESClientYamlSuiteTestCaseFailLogIT(final ClientYamlTestCandidate testCandidate) {
2328
super(testCandidate);
2429
}
@@ -65,4 +70,9 @@ public void test() throws IOException {
6570
mockLog.assertAllExpectationsMatched();
6671
}
6772
}
73+
74+
@Override
75+
protected String getTestRestCluster() {
76+
return cluster.getHttpAddresses();
77+
}
6878
}

0 commit comments

Comments
 (0)