Skip to content

Commit 19dc629

Browse files
committed
Test query builder bwc against previous supported versions instead of just the current version.
Relates to #25456
1 parent a443619 commit 19dc629

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

qa/query-builder-bwc/build.gradle

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ task bwcTest {
3030
group = 'verification'
3131
}
3232

33-
// For now test against the current version:
34-
Version currentVersion = Version.fromString(VersionProperties.elasticsearch.minus('-SNAPSHOT'))
35-
Version[] versions = [currentVersion]
36-
// TODO: uncomment when there is a released version with: https://github.com/elastic/elasticsearch/pull/25456
37-
// versions = indexCompatVersions
38-
for (Version version : versions) {
33+
for (Version version : indexCompatVersions) {
3934
String baseName = "v${version}"
4035

4136
Task oldQueryBuilderTest = tasks.create(name: "${baseName}#oldQueryBuilderTest", type: RestIntegTestTask) {
@@ -48,9 +43,8 @@ for (Version version : versions) {
4843

4944
configure(extensions.findByName("${baseName}#oldQueryBuilderTestCluster")) {
5045
distribution = 'zip'
51-
// TODO: uncomment when there is a released version with: https://github.com/elastic/elasticsearch/pull/25456
52-
// bwcVersion = version
53-
// numBwcNodes = 1
46+
bwcVersion = version
47+
numBwcNodes = 1
5448
numNodes = 1
5549
clusterName = 'query_builder_bwc'
5650
setting 'http.content_type.required', 'true'
@@ -89,7 +83,7 @@ test.enabled = false // no unit tests for rolling upgrades, only the rest integr
8983
// basic integ tests includes testing bwc against the most recent version
9084
task integTest {
9185
if (project.bwc_tests_enabled) {
92-
dependsOn = ["v${versions[-1]}#bwcTest"]
86+
dependsOn = ["v${indexCompatVersions[-1]}#bwcTest"]
9387
}
9488
}
9589

qa/query-builder-bwc/src/test/java/org/elasticsearch/bwc/QueryBuilderBWCIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@
6161

6262
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
6363

64+
/**
65+
* An integration test that tests whether percolator queries stored in older supported ES version can still be read by the
66+
* current ES version. Percolator queries are stored in the binary format in a dedicated doc values field (see
67+
* PercolatorFieldMapper#createQueryBuilderField(...) method). Using the query builders writable contract. This test
68+
* does best effort verifying that we don't break bwc for query builders between the first previous major version and
69+
* the latest current major release.
70+
*
71+
* The queries to test are specified in json format, which turns out to work because we tend break here rarely. If the
72+
* json format of a query being tested here then feel free to change this.
73+
*/
6474
public class QueryBuilderBWCIT extends ESRestTestCase {
6575

6676
private static final List<Object[]> CANDIDATES = new ArrayList<>();

0 commit comments

Comments
 (0)