Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate CardinalityIT test to AggregatorTestCase #80951

Conversation

salvatore-campagna
Copy link
Contributor

@salvatore-campagna salvatore-campagna commented Nov 23, 2021

Replace integration tests with unit tests for cardinality aggregations.
Unit tests are generally faster and easier to test against.

This is part of the transition from integration to unit tests described by #42893

@cla-checker-service
Copy link

cla-checker-service bot commented Nov 23, 2021

💚 CLA has been signed

@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 23, 2021
@salvatore-campagna
Copy link
Contributor Author

@elasticmachine run CLA

@salvatore-campagna salvatore-campagna added the >test Issues or PRs that are addressing/adding tests label Nov 23, 2021
@csoulios csoulios changed the title Feature/migrate cardinalityit to aggregator test case Migrate CardinalityIT test to AggregatorTestCase Nov 24, 2021
@salvatore-campagna salvatore-campagna force-pushed the feature/migrate-cardinalityit-to-aggregator-test-case branch from 1cf48ab to 2c9d2f9 Compare November 24, 2021 14:28
Copy link
Contributor

@csoulios csoulios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good first effort. Perhaps you should override the getSupportedValuesSourceTypes() method so that we test the matrix of supported/unsupported field types.

Also, I think that some aggregation tests from CardinalityIT have not been ported to CardinalityAggregatorTests (testAsSubAgg, testScriptCaching, testPartiallyUnmapped and the "value script" tests) (check MaxAggregatorTests on how to implement some of them)

Overriding getSupportedValuesSourceTypes and createAggBuilderForTypeTest
results in testing all the supported value types for the cardinality
aggregator. The cardinality aggregator supports all core values types.
This test uses a terms aggregation as a top level aggregation
and a cardinality aggregation as a sub-aggretation.
@salvatore-campagna
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/rest-compatibility

Copy link
Contributor

@csoulios csoulios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add couple more comments.

@salvatore-campagna
Copy link
Contributor Author

@elasticmachine update branch

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@csoulios csoulios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@salvatore-campagna
Copy link
Contributor Author

@elasticmachine update branch

@salvatore-campagna salvatore-campagna merged commit 1acfc92 into elastic:master Dec 1, 2021
@csoulios
Copy link
Contributor

csoulios commented Dec 1, 2021

Congrats on your first PR getting merged! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >refactoring Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants