Skip to content

Commit cd4116c

Browse files
authored
Run aggs tests in aggs module (#90851)
Run the aggregations tests v7 compat tests against the aggregations module and *not* the `rest-api-spec` module. This allows us to drop `rest-api-spec`'s dependency on the aggregations module and keep it "just the server" which is nice. There are a few side effects here that are ok: 1. We run all aggregations REST tests in the aggregations module. Even the ones in `rest-api-spec`. This means we run them twice. We plan to move all of the aggregations REST tests into the aggregations module anyway. 2. We now bundle the REST tests in the aggregations module into the tests that the clients run for their verification step. This should keep our clients from losing coverage.
1 parent a261528 commit cd4116c

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/rest/compat/YamlRestCompatTestPlugin.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class YamlRestCompatTestPlugin implements Plugin<Project> {
5858
private static final Path RELATIVE_API_PATH = Path.of("rest-api-spec/api");
5959
private static final Path RELATIVE_TEST_PATH = Path.of("rest-api-spec/test");
6060
private static final Path RELATIVE_REST_API_RESOURCES = Path.of("rest-api-spec/src/main/resources");
61+
private static final Path RELATIVE_REST_CORE = Path.of("rest-api-spec");
6162
private static final Path RELATIVE_REST_XPACK_RESOURCES = Path.of("x-pack/plugin/src/test/resources");
6263
private static final Path RELATIVE_REST_PROJECT_RESOURCES = Path.of("src/yamlRestTest/resources");
6364
private static final int COMPATIBLE_VERSION = Version.fromString(VersionProperties.getVersions().get("elasticsearch")).getMajor() - 1;
@@ -142,7 +143,11 @@ public void apply(Project project) {
142143
task.getOutputResourceDir().set(projectLayout.getBuildDirectory().dir(compatTestsDir.resolve("original").toString()));
143144
task.setCoreConfigToFileTree(
144145
config -> fileOperations.fileTree(
145-
config.getSingleFile().toPath().resolve(RELATIVE_REST_API_RESOURCES).resolve(RELATIVE_TEST_PATH)
146+
config.getSingleFile()
147+
.toPath()
148+
.resolve(RELATIVE_REST_CORE)
149+
.resolve(RELATIVE_REST_PROJECT_RESOURCES)
150+
.resolve(RELATIVE_TEST_PATH)
146151
)
147152
);
148153
task.setXpackConfigToFileTree(

modules/aggregations/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,23 @@ restResources {
1818
restApi {
1919
include '_common', 'indices', 'cluster', 'index', 'search', 'nodes', 'bulk'
2020
}
21+
restTests {
22+
// Pulls in all aggregation tests from core AND the forwards v7's core for forwards compatibility
23+
includeCore 'search.aggregation'
24+
}
25+
}
26+
27+
tasks.named("yamlRestTestV7CompatTransform").configure { task ->
28+
task.skipTest("search.aggregation/20_terms/string profiler via global ordinals filters implementation", "The profiler results aren't backwards compatible.")
29+
task.skipTest("search.aggregation/20_terms/string profiler via global ordinals native implementation", "The profiler results aren't backwards compatible.")
30+
task.skipTest("search.aggregation/20_terms/string profiler via map", "The profiler results aren't backwards compatible.")
31+
task.skipTest("search.aggregation/20_terms/numeric profiler", "The profiler results aren't backwards compatible.")
32+
task.skipTest("search.aggregation/210_top_hits_nested_metric/top_hits aggregation with sequence numbers", "#42809 the use nested path and filter sort throws an exception")
33+
task.skipTest("search.aggregation/370_doc_count_field/Test filters agg with doc_count", "Uses profiler for assertions which is not backwards compatible")
34+
35+
task.addAllowedWarningRegex("\\[types removal\\].*")
36+
}
37+
38+
artifacts {
39+
restTests(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
2140
}

rest-api-spec/build.gradle

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ artifacts {
3535

3636
testClusters.configureEach {
3737
module ':modules:mapper-extras'
38-
// This dependency can be removed when aggregations and
39-
// respective yaml test have been moved to aggregations module.
40-
// See for the progress: https://github.com/elastic/elasticsearch/issues/90283
41-
module ':modules:aggregations'
4238
requiresFeature 'es.index_mode_feature_flag_registered', Version.fromString("8.0.0")
4339
}
4440

@@ -47,6 +43,7 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task ->
4743
task.skipTestsByFilePattern("**/cat*/*.yml", "Cat API are meant to be consumed by humans, so will not be supported by Compatible REST API")
4844
task.skipTestsByFilePattern("**/indices.upgrade/*.yml", "upgrade api will only get a dummy endpoint returning an exception suggesting to use _reindex")
4945
task.skipTestsByFilePattern("**/indices.stats/60_field_usage/*/*.yml", "field usage results will be different between lucene versions")
46+
task.skipTestsByFilePattern("**/search.aggregation/*.yml", "run by the aggregation module")
5047

5148
task.skipTest("bulk/11_dynamic_templates/Dynamic templates", "Error message has changed")
5249
task.skipTest("indices.create/20_mix_typeless_typeful/Implicitly create a typed index while there is a typeless template", "Type information about the type is removed and not passed down. The logic to check for this is also removed.")
@@ -70,18 +67,12 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task ->
7067
task.skipTest("indices.stats/20_translog/Translog retention settings are deprecated", "translog settings removal is not supported under compatible api")
7168
task.skipTest("indices.stats/20_translog/Translog retention without soft_deletes", "translog settings removal is not supported under compatible api")
7269
task.skipTest("indices.stats/20_translog/Translog stats on closed indices without soft-deletes", "translog settings removal is not supported under compatible api")
73-
task.skipTest("search.aggregation/370_doc_count_field/Test filters agg with doc_count", "Uses profiler for assertions which is not backwards compatible")
7470
task.skipTest("indices.create/10_basic/Create index without soft deletes", "Make soft-deletes mandatory in 8.0 #51122 - settings changes are note supported in Rest Api compatibility")
7571
task.skipTest("field_caps/30_filter/Field caps with index filter", "behaviour change after #63692 4digits dates are parsed as epoch and in quotes as year")
7672
task.skipTest("indices.forcemerge/10_basic/Check deprecation warning when incompatible only_expunge_deletes and max_num_segments values are both set", "#44761 bug fix")
7773
task.skipTest("search/340_type_query/type query", "#47207 type query throws exception in compatible mode")
78-
task.skipTest("search.aggregation/210_top_hits_nested_metric/top_hits aggregation with sequence numbers", "#42809 the use nested path and filter sort throws an exception")
7974
task.skipTest("search/310_match_bool_prefix/multi_match multiple fields with cutoff_frequency throws exception", "#42654 cutoff_frequency, common terms are not supported. Throwing an exception")
8075
task.skipTest("search_shards/10_basic/Search shards aliases with and without filters", "Filter representation no longer outputs default boosts")
81-
task.skipTest("search.aggregation/20_terms/string profiler via global ordinals filters implementation", "The profiler results aren't backwards compatible.")
82-
task.skipTest("search.aggregation/20_terms/string profiler via global ordinals native implementation", "The profiler results aren't backwards compatible.")
83-
task.skipTest("search.aggregation/20_terms/string profiler via map", "The profiler results aren't backwards compatible.")
84-
task.skipTest("search.aggregation/20_terms/numeric profiler", "The profiler results aren't backwards compatible.")
8576
task.skipTest("migration/10_get_feature_upgrade_status/Get feature upgrade status", "Awaits backport")
8677
task.skipTest("search/330_fetch_fields/Test disable source", "Error no longer thrown")
8778
task.skipTest("search/240_date_nanos/doc value fields are working as expected across date and date_nanos fields", "Fetching docvalues field multiple times is no longer allowed")

x-pack/rest-resources-zip/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ configurations {
1919
dependencies {
2020
apis project(path: ':rest-api-spec', configuration: 'restSpecs')
2121
freeTests project(path: ':rest-api-spec', configuration: 'restTests')
22+
freeTests project(path: ':modules:aggregations', configuration: 'restTests')
2223
compatApis project(path: ':rest-api-spec', configuration: 'restCompatSpecs')
2324
compatApis project(path: ':x-pack:plugin', configuration: 'restCompatSpecs')
2425
freeCompatTests project(path: ':rest-api-spec', configuration: 'restCompatTests')

0 commit comments

Comments
 (0)