Skip to content

Commit 8f42478

Browse files
authored
Use safe double range to test long mapper (#133423)
Until #132893 is fixed this sounds like the best way to handle it.
1 parent 8f41a4b commit 8f42478

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

muted-tests.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -489,21 +489,12 @@ tests:
489489
- class: org.elasticsearch.search.CCSDuelIT
490490
method: testTermsAggsWithProfile
491491
issue: https://github.com/elastic/elasticsearch/issues/132880
492-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
493-
method: testFetchMany
494-
issue: https://github.com/elastic/elasticsearch/issues/132948
495-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
496-
method: testFetch
497-
issue: https://github.com/elastic/elasticsearch/issues/132956
498492
- class: org.elasticsearch.cluster.ClusterInfoServiceIT
499493
method: testMaxQueueLatenciesInClusterInfo
500494
issue: https://github.com/elastic/elasticsearch/issues/132957
501495
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
502496
method: test {p0=search/400_synthetic_source/_doc_count}
503497
issue: https://github.com/elastic/elasticsearch/issues/132965
504-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
505-
method: testSyntheticSourceWithTranslogSnapshot
506-
issue: https://github.com/elastic/elasticsearch/issues/132964
507498
- class: org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT
508499
method: test {p0=search/160_exists_query/Test exists query on unmapped float field}
509500
issue: https://github.com/elastic/elasticsearch/issues/132984
@@ -594,15 +585,9 @@ tests:
594585
- class: org.elasticsearch.xpack.search.CrossClusterAsyncSearchIT
595586
method: testCCSClusterDetailsWhereAllShardsSkippedInCanMatch
596587
issue: https://github.com/elastic/elasticsearch/issues/133370
597-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
598-
method: testSyntheticSourceMany
599-
issue: https://github.com/elastic/elasticsearch/issues/133394
600588
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
601589
method: test {p0=search.vectors/42_knn_search_int4_flat/kNN search with filter}
602590
issue: https://github.com/elastic/elasticsearch/issues/133420
603-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
604-
method: testSyntheticSourceInNestedObject
605-
issue: https://github.com/elastic/elasticsearch/issues/133426
606591
- class: org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT
607592
method: test {p0=search/160_exists_query/Test exists query on date field in empty index}
608593
issue: https://github.com/elastic/elasticsearch/issues/133439
@@ -627,9 +612,6 @@ tests:
627612
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT
628613
method: testStopQueryLocal
629614
issue: https://github.com/elastic/elasticsearch/issues/133481
630-
- class: org.elasticsearch.index.mapper.LongFieldMapperTests
631-
method: testSyntheticSource
632-
issue: https://github.com/elastic/elasticsearch/issues/133496
633615
- class: org.elasticsearch.xpack.logsdb.qa.StandardVersusStandardReindexedIntoLogsDbChallengeRestIT
634616
method: testEsqlSource
635617
issue: https://github.com/elastic/elasticsearch/issues/132601

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

Lines changed: 5 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,8 @@ protected Number randomNumber() {
111114
if (randomBoolean()) {
112115
return randomDouble();
113116
}
114-
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);
115119
}
116120

117121
public void testFetchCoerced() throws IOException {

0 commit comments

Comments
 (0)