Skip to content

Commit 61d4408

Browse files
authored
Use safe double range to test long mapper (#133423) (#133586)
Until #132893 is fixed this sounds like the best way to handle it. (cherry picked from commit 8f42478) # Conflicts: # muted-tests.yml # server/src/test/java/org/elasticsearch/index/mapper/LongFieldMapperTests.java
1 parent d2e816d commit 61d4408

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/src/test/java/org/elasticsearch/index/mapper/LongFieldMapperTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public void testLongIndexingCoercesIntoRange() throws Exception {
104104
assertThat(doc.rootDoc().getFields("field"), hasSize(1));
105105
}
106106

107+
// This is the biggest long that double can represent exactly
108+
public static final long MAX_SAFE_LONG_FOR_DOUBLE = 1L << 53;
109+
107110
@Override
108111
protected Number randomNumber() {
109112
if (randomBoolean()) {
@@ -112,8 +115,8 @@ protected Number randomNumber() {
112115
if (randomBoolean()) {
113116
return randomDouble();
114117
}
115-
assumeFalse("https://github.com/elastic/elasticsearch/issues/70585", true);
116-
return randomDoubleBetween(Long.MIN_VALUE, Long.MAX_VALUE, true);
118+
// TODO: increase the range back to full LONG range once https://github.com/elastic/elasticsearch/issues/132893 is fixed
119+
return randomDoubleBetween(-MAX_SAFE_LONG_FOR_DOUBLE, MAX_SAFE_LONG_FOR_DOUBLE, true);
117120
}
118121

119122
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/70585")

0 commit comments

Comments
 (0)