Skip to content

Commit 73dcff4

Browse files
committed
Use safe double range to test long mapper
Until #132893 is fixed this sounds like the best way to handle it.
1 parent 86b96a7 commit 73dcff4

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

muted-tests.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -510,21 +510,12 @@ tests:
510510
- class: org.elasticsearch.search.CCSDuelIT
511511
method: testTermsAggsWithProfile
512512
issue: https://github.com/elastic/elasticsearch/issues/132880
513-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
514-
method: testFetchMany
515-
issue: https://github.com/elastic/elasticsearch/issues/132948
516-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
517-
method: testFetch
518-
issue: https://github.com/elastic/elasticsearch/issues/132956
519513
- class: org.elasticsearch.cluster.ClusterInfoServiceIT
520514
method: testMaxQueueLatenciesInClusterInfo
521515
issue: https://github.com/elastic/elasticsearch/issues/132957
522516
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
523517
method: test {p0=search/400_synthetic_source/_doc_count}
524518
issue: https://github.com/elastic/elasticsearch/issues/132965
525-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
526-
method: testSyntheticSourceWithTranslogSnapshot
527-
issue: https://github.com/elastic/elasticsearch/issues/132964
528519
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
529520
method: test {p0=search/160_exists_query/Test exists query on unmapped float field}
530521
issue: https://github.com/elastic/elasticsearch/issues/132984
@@ -615,9 +606,6 @@ tests:
615606
- class: org.elasticsearch.xpack.search.CrossClusterAsyncSearchIT
616607
method: testCCSClusterDetailsWhereAllShardsSkippedInCanMatch
617608
issue: https://github.com/elastic/elasticsearch/issues/133370
618-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
619-
method: testSyntheticSourceMany
620-
issue: https://github.com/elastic/elasticsearch/issues/133394
621609
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
622610
method: test {p0=search.vectors/42_knn_search_int4_flat/kNN search with filter}
623611
issue: https://github.com/elastic/elasticsearch/issues/133420

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

Lines changed: 4 additions & 1 deletion
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,7 +114,7 @@ protected Number randomNumber() {
111114
if (randomBoolean()) {
112115
return randomDouble();
113116
}
114-
return randomDoubleBetween(Long.MIN_VALUE, Long.MAX_VALUE, true);
117+
return randomDoubleBetween(-MAX_SAFE_LONG_FOR_DOUBLE, MAX_SAFE_LONG_FOR_DOUBLE, true);
115118
}
116119

117120
public void testFetchCoerced() throws IOException {

0 commit comments

Comments
 (0)