Skip broken test

In #63242 we changed how we build `nextRoundingValue` to, well, be
correct. But the old `org.elasticsearch.common.rounding.Rounding`
implementation didn't get the fix. Which is fine, because it doesn't
that method on that implementation doesn't receive any use outside of
tests. In fact, it is entirely removed in master. Anyway, now that the
two implementation produce different values we really can't go around
asserting that they produce the same values now can we? Well, we were!
This skips that assertion if we know `nextRoundingValue` is implemented
differently.

Closes #63256
This commit is contained in:
Nik Everett 2020-10-05 14:20:04 -04:00
parent 791a9d5102
commit 7f07deb8d8
1 changed files with 6 additions and 2 deletions

View File

@ -35,15 +35,17 @@ public class RoundingDuelTests extends ESTestCase {
// dont include nano/micro seconds as rounding would become zero then and throw an exception // dont include nano/micro seconds as rounding would become zero then and throw an exception
private static final String[] ALLOWED_TIME_SUFFIXES = new String[]{"d", "h", "ms", "s", "m"}; private static final String[] ALLOWED_TIME_SUFFIXES = new String[]{"d", "h", "ms", "s", "m"};
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/63256")
public void testSerialization() throws Exception { public void testSerialization() throws Exception {
org.elasticsearch.common.Rounding.DateTimeUnit randomDateTimeUnit = org.elasticsearch.common.Rounding.DateTimeUnit randomDateTimeUnit =
randomFrom(org.elasticsearch.common.Rounding.DateTimeUnit.values()); randomFrom(org.elasticsearch.common.Rounding.DateTimeUnit.values());
org.elasticsearch.common.Rounding rounding; org.elasticsearch.common.Rounding rounding;
boolean oldNextRoundingValueWorks;
if (randomBoolean()) { if (randomBoolean()) {
rounding = org.elasticsearch.common.Rounding.builder(randomDateTimeUnit).timeZone(ZoneOffset.UTC).build(); rounding = org.elasticsearch.common.Rounding.builder(randomDateTimeUnit).timeZone(ZoneOffset.UTC).build();
oldNextRoundingValueWorks = true;
} else { } else {
rounding = org.elasticsearch.common.Rounding.builder(timeValue()).timeZone(ZoneOffset.UTC).build(); rounding = org.elasticsearch.common.Rounding.builder(timeValue()).timeZone(ZoneOffset.UTC).build();
oldNextRoundingValueWorks = false;
} }
BytesStreamOutput output = new BytesStreamOutput(); BytesStreamOutput output = new BytesStreamOutput();
output.setVersion(VersionUtils.getPreviousVersion(Version.V_7_0_0)); output.setVersion(VersionUtils.getPreviousVersion(Version.V_7_0_0));
@ -55,7 +57,9 @@ public class RoundingDuelTests extends ESTestCase {
int randomInt = randomIntBetween(1, 1_000_000_000); int randomInt = randomIntBetween(1, 1_000_000_000);
assertThat(roundingJoda.round(randomInt), is(roundingJavaTime.round(randomInt))); assertThat(roundingJoda.round(randomInt), is(roundingJavaTime.round(randomInt)));
assertThat(roundingJoda.nextRoundingValue(randomInt), is(roundingJavaTime.nextRoundingValue(randomInt))); if (oldNextRoundingValueWorks) {
assertThat(roundingJoda.nextRoundingValue(randomInt), is(roundingJavaTime.nextRoundingValue(randomInt)));
}
} }
public void testDuellingImplementations() { public void testDuellingImplementations() {