Skip to content

Commit ccc8f24

Browse files
smalyshevsarog
authored andcommitted
Use safe double range to test long mapper (elastic#133423) (elastic#133585)
Until elastic#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 e1e8a6a commit ccc8f24

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
@@ -103,6 +103,9 @@ public void testLongIndexingCoercesIntoRange() throws Exception {
103103
assertThat(doc.rootDoc().getFields("field"), hasSize(1));
104104
}
105105

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

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

0 commit comments

Comments
 (0)