Modernize cardinality agg tests#90114
Conversation
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
| assertTrue(AggregationInspectionHelper.hasValue(cardinality)); | ||
|
|
||
| // Test that an aggregation not using a script does get cached | ||
| assertTrue(context.isCacheable()); |
There was a problem hiding this comment.
This assert is the only thing this test adds over the refactored test above. I don't know where we should be testing that SearchExecutionContext is setting this correctly, but I don't think this is the right place. And having an aggregation context reference at this point is not good. Let's discuss if this test adds enough value that we should re-create it somewhere closer to the code actually being tested.
There was a problem hiding this comment.
👍
I wonder if we should assert that all aggs are cacheable in test-case unless we have some kind of flag.
There was a problem hiding this comment.
That seems sensible. I'll try that and see if anything breaks.
There was a problem hiding this comment.
So exactly two tests broke, both of which are sorting by a script so it makes sense they shouldn't be cached. With #90149 merged, I am able to communicate that information to the right place in the test framework, with minimal intrusion on the rest of the code. So I think we should be all set here.
|
Nice!
…On Tue, Sep 20, 2022, 3:43 PM Mark Tozzi ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
server/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregatorTests.java
<#90114 (comment)>
:
> - final CardinalityAggregationBuilder aggregationBuilder = new CardinalityAggregationBuilder("cardinality").field("number");
-
- final AggregationContext context = createAggregationContext(indexSearcher, null, fieldType);
- final CardinalityAggregator aggregator = createAggregator(aggregationBuilder, context);
- aggregator.preCollection();
- indexSearcher.search(new MatchAllDocsQuery(), aggregator.asCollector());
- aggregator.postCollection();
-
- final InternalCardinality cardinality = (InternalCardinality) aggregator.buildAggregation(0L);
-
- assertEquals(10.0, cardinality.getValue(), 0);
- assertEquals("cardinality", cardinality.getName());
- assertTrue(AggregationInspectionHelper.hasValue(cardinality));
-
- // Test that an aggregation not using a script does get cached
- assertTrue(context.isCacheable());
So exactly two tests broke, both of which are sorting by a script so it
makes sense they shouldn't be cached. With #90149
<#90149> merged, I am able
to communicate that information to the right place in the test framework,
with minimal intrusion on the rest of the code. So I think we should be all
set here.
—
Reply to this email directly, view it on GitHub
<#90114 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABUXIUI6C35QOAUBBI2NEDV7IHWRANCNFSM6AAAAAAQNYKTSQ>
.
You are receiving this because you are on a team that was mentioned.Message
ID: ***@***.***>
|
|
@elasticmachine update branch |
* main: (186 commits) [DOCS] Add 8.5 release notes and fix links (elastic#90201) Mute DownsampleActionSingleNodeTests.testCannotRollupWhileOtherRollupInProgress (elastic#90198) Bump to version 8.6.0 Increase the minimum size of the management pool to 2 (elastic#90193) Speed `getIntLE` from `BytesReference` (elastic#90147) Restrict nodes for testClusterPrimariesActive1 (elastic#90191) Fix bug with `BigIntArray` serialization (elastic#90142) Synthetic _source: test _source filtering (elastic#90138) Modernize cardinality agg tests (elastic#90114) Mute failing test (elastic#90186) Move assertion in ES85BloomFilterPostingsFormat to fix test (elastic#90150) Restrict nodes for testClusterPrimariesActive2 (elastic#90184) Batch index delete cluster state updates (elastic#90033) Register stable plugins in ActionModule (elastic#90067) Mute failing test (elastic#90180) [HealthAPI] Disk: Use _ for diagnosis id (elastic#90179) [HealtAPI] Disk: use shorter help URLs (elastic#90178) Fixing disk health indicator unit tests (elastic#90175) Enable the health node and the disk health indicator elastic#84811 (elastic#90085) Add missing Disk Indicator health api IDs (elastic#90174) ...
* main: (121 commits) [DOCS] Add 8.5 release notes and fix links (elastic#90201) Mute DownsampleActionSingleNodeTests.testCannotRollupWhileOtherRollupInProgress (elastic#90198) Bump to version 8.6.0 Increase the minimum size of the management pool to 2 (elastic#90193) Speed `getIntLE` from `BytesReference` (elastic#90147) Restrict nodes for testClusterPrimariesActive1 (elastic#90191) Fix bug with `BigIntArray` serialization (elastic#90142) Synthetic _source: test _source filtering (elastic#90138) Modernize cardinality agg tests (elastic#90114) Mute failing test (elastic#90186) Move assertion in ES85BloomFilterPostingsFormat to fix test (elastic#90150) Restrict nodes for testClusterPrimariesActive2 (elastic#90184) Batch index delete cluster state updates (elastic#90033) Register stable plugins in ActionModule (elastic#90067) Mute failing test (elastic#90180) [HealthAPI] Disk: Use _ for diagnosis id (elastic#90179) [HealtAPI] Disk: use shorter help URLs (elastic#90178) Fixing disk health indicator unit tests (elastic#90175) Enable the health node and the disk health indicator elastic#84811 (elastic#90085) Add missing Disk Indicator health api IDs (elastic#90174) ...
This converts one test in the Cardinality tests to use (a new multi index version of) test case, which will eventually enable better memory accounting testing. It also deletes a second test, which was only verifying that the aggregation context has the correct cache settings - that's not cardinality related, and testing it here is actually a PITA. We're trying to push all aggregation context handling into one path, so we can make sure it's accessed correctly with regards to closing.