Skip to content

Conversation

@andyb-elastic
Copy link
Contributor

This adds tests for supported ValuesSourceTypes, unmapped fields,
scripting, and the missing param. The tests for unmapped fields and
scripting are migrated from the SumIT integration test

This adds tests for supported ValuesSourceTypes, unmapped fields,
scripting, and the missing param. The tests for unmapped fields and
scripting are migrated from the SumIT integration test
@andyb-elastic andyb-elastic added >test Issues or PRs that are addressing/adding tests :Analytics/Aggregations Aggregations v8.0.0 labels Mar 14, 2020
@elasticmachine
Copy link
Collaborator

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

assertThat(sum.getValue(), equalTo(0.0));
}

/** This test has been moved to {@link SumAggregatorTests#testUnmapped()} */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are because this class still extends AbstractNumericTestCase - the remainder of the tests will migrate in another pr

import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static java.util.stream.Collectors.toList;
import static org.elasticsearch.common.lucene.search.Queries.newMatchAllQuery;
Copy link
Member

Choose a reason for hiding this comment

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

Personally I don't think this is an improvement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's probably a net negative on readability

.script(new Script(ScriptType.INLINE, MockScriptEngine.NAME, FIELD_SCRIPT_NAME, singletonMap("field", FIELD_NAME))));
}

private void scriptTestCase(int numValuesPerField, SumAggregationBuilder builder) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this name is right. It looks like it is just a generic "does random stuff reduce right" kind of thing.

Copy link
Contributor Author

@andyb-elastic andyb-elastic Mar 16, 2020

Choose a reason for hiding this comment

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

Had the same thought after writing it - the script specific part is the expectedSum = sum + (numDocs * numValuesPerField); because it expects the script to increment all the fields by 1

I'll see if I can make it less confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it a little more general and moved some other test cases to it too. Still not thrilled with its readability

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. Incremental improvement!

@andyb-elastic andyb-elastic merged commit a295161 into elastic:master Mar 17, 2020
@andyb-elastic
Copy link
Contributor Author

Thanks!

andyb-elastic added a commit to andyb-elastic/elasticsearch that referenced this pull request Apr 1, 2020
This adds tests for supported ValuesSourceTypes, unmapped fields,
scripting, and the missing param. The tests for unmapped fields and
scripting are migrated from the SumIT integration test
andyb-elastic added a commit that referenced this pull request Apr 1, 2020
This adds tests for supported ValuesSourceTypes, unmapped fields,
scripting, and the missing param. The tests for unmapped fields and
scripting are migrated from the SumIT integration test
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.

4 participants