Skip to content

Commit f92bcc1

Browse files
committed
[9.0] Convert :test projects to new testing framework (elastic#125724) (elastic#125742)
* Convert `:test` projects to new testing framework (elastic#125724) (cherry picked from commit e149a3e) # Conflicts: # build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java # test/external-modules/error-query/build.gradle # test/external-modules/error-query/src/javaRestTest/java/org/elasticsearch/test/esql/EsqlPartialResultsIT.java * Bump timeout (cherry picked from commit 533d38d) # Conflicts: # test/external-modules/error-query/build.gradle
1 parent ce367e9 commit f92bcc1

File tree

7 files changed

+54
-26
lines changed

7 files changed

+54
-26
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
@@ -41,12 +41,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
4141
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-with-all-dependencies");
4242
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-plugins");
4343
map.put(LegacyRestTestBasePlugin.class, ":qa:system-indices");
44-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-apm-integration");
45-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-delayed-aggs");
46-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-die-with-dignity");
47-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-error-query");
48-
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-latency-simulating-directory");
49-
map.put(LegacyRestTestBasePlugin.class, ":test:yaml-rest-runner");
5044
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core");
5145
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
5246
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
@@ -65,8 +59,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
6559
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-plugins-ssl");
6660
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-security-with-mustache");
6761
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:xpack-prefix-rest-compat");
68-
map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-geoip:qa:file-based-update");
69-
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce:qa:gce");
7062
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-basic-license");
7163
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-full-license");
7264
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
@@ -8,11 +8,7 @@
88
*/
99
import org.elasticsearch.gradle.internal.info.BuildParams
1010

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

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

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 & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,10 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

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

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

2315
esplugin {
2416
description = 'A test module that exposes a way to simulate search shard failures and warnings'
@@ -30,3 +22,14 @@ restResources {
3022
include '_common', 'indices', 'index', 'cluster', 'search'
3123
}
3224
}
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/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/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)