Skip to content

Commit f3870e6

Browse files
authored
Fix AutoDateHistogramAggregatorTests failures (#55947)
1 parent fd554d9 commit f3870e6

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/AutoDateHistogramAggregatorTests.java

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,12 @@ public void testAggregateWrongField() throws IOException {
220220
fieldType.setHasDocValues(true);
221221
fieldType.setName("date_field");
222222

223-
testCase(
224-
aggregation,
225-
DEFAULT_QUERY,
223+
testCase(aggregation, DEFAULT_QUERY,
226224
iw -> {},
227225
(Consumer<InternalAutoDateHistogram>) histogram -> {
228-
// TODO: searchAndReduce incorrectly returns null for empty aggs
229-
assertNull(histogram);
230-
/*
231226
assertEquals(0, histogram.getBuckets().size());
232227
assertFalse(AggregationInspectionHelper.hasValue(histogram));
233-
*/
234-
},
235-
fieldType
236-
);
228+
}, fieldType);
237229
}
238230

239231
public void testUnmappedMissing() throws IOException {
@@ -245,23 +237,14 @@ public void testUnmappedMissing() throws IOException {
245237
fieldType.setHasDocValues(true);
246238
fieldType.setName("date_field");
247239

248-
testCase(
249-
aggregation,
250-
DEFAULT_QUERY,
240+
testCase(aggregation, DEFAULT_QUERY,
251241
iw -> {},
252242
(Consumer<InternalAutoDateHistogram>) histogram -> {
253-
// TODO: searchAndReduce incorrectly returns null for empty aggs
254-
assertNull(histogram);
255-
/*
256-
assertEquals(1, histogram.getBuckets().size());
257-
assertTrue(AggregationInspectionHelper.hasValue(histogram));
258-
*/
259-
},
260-
fieldType
261-
);
243+
assertEquals(0, histogram.getBuckets().size());
244+
assertFalse(AggregationInspectionHelper.hasValue(histogram));
245+
}, fieldType);
262246
}
263247

264-
265248
public void testIntervalYear() throws IOException {
266249
final long start = LocalDate.of(2015, 1, 1).atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli();
267250
final long end = LocalDate.of(2017, 12, 31).atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli();

0 commit comments

Comments
 (0)