From d976f312388589a6e47515b9898dcbe6c5b2ba5f Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Tue, 14 Jan 2020 12:08:11 -0800 Subject: [PATCH] re-enable bwc tests and update geo-grid bounds version guard to 7.6 after #50996 (#50997) after #50996 (backport of #50002) merged, the version guard on geo-grid `bounds` parameter can be updated to 7.6 re-enables bwc tests --- build.gradle | 4 ++-- .../bucket/composite/GeoTileGridValuesSourceBuilder.java | 4 ++-- .../bucket/geogrid/GeoGridAggregationBuilder.java | 4 ++-- .../search/aggregations/bucket/GeoHashGridTests.java | 4 ++-- .../search/aggregations/bucket/GeoTileGridTests.java | 4 ++-- .../bucket/composite/GeoTileGridValuesSourceBuilderTests.java | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index b8c19c8f4373f..b03bb7e5a3794 100644 --- a/build.gradle +++ b/build.gradle @@ -205,8 +205,8 @@ task verifyVersions { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = false -final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/50996" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = true +final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ if (bwc_tests_enabled == false) { if (bwc_tests_disabled_issue.isEmpty()) { throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false") diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java index 30728af31b730..165a50db60d18 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilder.java @@ -67,7 +67,7 @@ static GeoTileGridValuesSourceBuilder parse(String name, XContentParser parser) GeoTileGridValuesSourceBuilder(StreamInput in) throws IOException { super(in); this.precision = in.readInt(); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { + if (in.getVersion().onOrAfter(Version.V_7_6_0)) { this.geoBoundingBox = new GeoBoundingBox(in); } } @@ -90,7 +90,7 @@ public GeoTileGridValuesSourceBuilder format(String format) { @Override protected void innerWriteTo(StreamOutput out) throws IOException { out.writeInt(precision); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { + if (out.getVersion().onOrAfter(Version.V_7_6_0)) { geoBoundingBox.writeTo(out); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java index 233fd4c6885e8..0a7c918231c73 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java @@ -98,7 +98,7 @@ public GeoGridAggregationBuilder(StreamInput in) throws IOException { precision = in.readVInt(); requiredSize = in.readVInt(); shardSize = in.readVInt(); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { + if (in.getVersion().onOrAfter(Version.V_7_6_0)) { geoBoundingBox = new GeoBoundingBox(in); } } @@ -108,7 +108,7 @@ protected void innerWriteTo(StreamOutput out) throws IOException { out.writeVInt(precision); out.writeVInt(requiredSize); out.writeVInt(shardSize); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { + if (out.getVersion().onOrAfter(Version.V_7_6_0)) { geoBoundingBox.writeTo(out); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridTests.java index 883810b25d76b..9909495c230f0 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoHashGridTests.java @@ -59,10 +59,10 @@ protected GeoHashGridAggregationBuilder createTestAggregatorBuilder() { } public void testSerializationPreBounds() throws Exception { - Version noBoundsSupportVersion = VersionUtils.randomPreviousCompatibleVersion(random(), Version.V_8_0_0); + Version noBoundsSupportVersion = VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.V_7_5_0); GeoHashGridAggregationBuilder builder = createTestAggregatorBuilder(); try (BytesStreamOutput output = new BytesStreamOutput()) { - output.setVersion(Version.V_8_0_0); + output.setVersion(Version.V_7_6_0); builder.writeTo(output); try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), new NamedWriteableRegistry(Collections.emptyList()))) { diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoTileGridTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoTileGridTests.java index 33631d39f720d..dc2a72f387f11 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoTileGridTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/GeoTileGridTests.java @@ -59,10 +59,10 @@ protected GeoTileGridAggregationBuilder createTestAggregatorBuilder() { } public void testSerializationPreBounds() throws Exception { - Version noBoundsSupportVersion = VersionUtils.randomPreviousCompatibleVersion(random(), Version.V_8_0_0); + Version noBoundsSupportVersion = VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.V_7_5_0); GeoTileGridAggregationBuilder builder = createTestAggregatorBuilder(); try (BytesStreamOutput output = new BytesStreamOutput()) { - output.setVersion(Version.V_8_0_0); + output.setVersion(Version.V_7_6_0); builder.writeTo(output); try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), new NamedWriteableRegistry(Collections.emptyList()))) { diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilderTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilderTests.java index 7817a236d6680..17b63e0ee6603 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/GeoTileGridValuesSourceBuilderTests.java @@ -43,13 +43,13 @@ public void testSetFormat() { } public void testBWCBounds() throws IOException { - Version noBoundsSupportVersion = VersionUtils.randomPreviousCompatibleVersion(random(), Version.V_8_0_0); + Version noBoundsSupportVersion = VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.V_7_5_0); GeoTileGridValuesSourceBuilder builder = new GeoTileGridValuesSourceBuilder("name"); if (randomBoolean()) { builder.geoBoundingBox(GeoBoundingBoxTests.randomBBox()); } try (BytesStreamOutput output = new BytesStreamOutput()) { - output.setVersion(Version.V_8_0_0); + output.setVersion(Version.V_7_6_0); builder.writeTo(output); try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), new NamedWriteableRegistry(Collections.emptyList()))) {