Skip to content

Improve test coverage for bucket and metric aggregations #22278

@martijnvg

Description

@martijnvg

Today there is very little unit test coverage for bucket and metric aggregations. This meta issue aim is to significantly improve that. For each aggregation we should add more unit tests for the aggregator (how it interacts with the Lucene index via org.apache.lucene.search.Collector that each aggregation implements), the reduce logic and serialization of the aggregation results.

We should add unit tests for the following Aggregator implementations:

We should also add tests for the following InternalAggregation implementations:
(to test the reduce and result serialization logic)

I may have forgotten some classes, so please update this issue if that is the case :)

I listed the InternalAggregation implementations separately from Aggregator implementations as unit tests for each can be written in parallel by different devs. However I think for the less complex aggregations unit tests for both the InternalAggregation implementation and Aggregator implementations can be added in the same PR.

I think at least the unit tests should be added to the master branch. Backporting to 5.x branch is best effort and should only be considered if it is low hanging fruit.

I suggest that we work in the following way in order to avoid accidentally doing work twice:

  • Add your name the a task you like to work on before starting to write the unit tests.
  • When you open a pr then add the PR number to task.
  • Once the pr is merged, then check off the task.

Note that aggregations are tested, however due to how before the code was structured, unit testing was really difficult.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions