Skip to content

Conversation

@csoulios
Copy link
Contributor

PR that adds tests for supported ValuesSourceTypes for the MinAggregator

@csoulios csoulios added >test Issues or PRs that are addressing/adding tests :Analytics/Aggregations Aggregations v8.0.0 labels Mar 23, 2020
@csoulios csoulios requested a review from andyb-elastic March 23, 2020 20:31
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Aggregations)

Copy link
Contributor

@polyfractal polyfractal left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@andyb-elastic andyb-elastic left a comment

Choose a reason for hiding this comment

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

LGTM

Not sure if we want to do this or not, but in files like this one where there are some existing tests for unsupported types, I've been removing them, e.g.

public void testUnsupportedType() {
MinAggregationBuilder aggregationBuilder = new MinAggregationBuilder("min").field("not_a_number");
MappedFieldType fieldType = new KeywordFieldMapper.KeywordFieldType();
fieldType.setName("not_a_number");
fieldType.setHasDocValues(true);
IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
() -> testCase(aggregationBuilder, new MatchAllDocsQuery(), iw -> {
iw.addDocument(singleton(new SortedSetDocValuesField("string", new BytesRef("foo"))));
}, (Consumer<InternalMin>) min -> {
fail("Should have thrown exception");
}, fieldType));
assertEquals(e.getMessage(), "Expected numeric type on field [not_a_number], but got [keyword]");
}

It is covered by new supported-type tests.
@csoulios csoulios merged commit 5e637c4 into elastic:master Mar 24, 2020
@csoulios csoulios deleted the min-agg-tests branch March 24, 2020 09:32
csoulios added a commit to csoulios/elasticsearch that referenced this pull request Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations >test Issues or PRs that are addressing/adding tests v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants