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

Add unit tests for ParentToChildAggregator #23305

Merged
merged 3 commits into from
Feb 24, 2017

Conversation

cbuescher
Copy link
Member

Adds unit tests for the children aggregation.
This change also add the ability to mock Mapperservice in subtests of
AggregatorTestCase.

Relates to #22278

Adds unit tests for the `children` aggregation.
This change also add the ability to mock Mapperservice in subtests of
AggregatorTestCase.

Relates to elastic#22278
@cbuescher cbuescher added :Analytics/Aggregations Aggregations >enhancement >test Issues or PRs that are addressing/adding tests v6.0.0-alpha1 labels Feb 22, 2017
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

👍 Left one minor comment.

iw.addDocument(createParentDocument("parent2"));
iw.addDocument(createChildDocument("child2", "parent2", 5));
iw.addDocument(createChildDocument("child3", "parent2", 2));
iw.addDocument(createChildDocument("child4", "parent2", 7));
Copy link
Member

Choose a reason for hiding this comment

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

maybe add some more parent/child docs here? Or add another test that tests with more docs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I will try to randomize this (number or parents, children per parent) in a simple way.

// org.apache.lucene.search.QueryUtils$FCInvisibleMultiReader cannot be
// cast to org.apache.lucene.index.DirectoryReader
// according to @mvg this can be fixed later but requires bigger changes
IndexSearcher indexSearcher = newSearcher(indexReader, false, true);
Copy link
Member

Choose a reason for hiding this comment

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

Sadly yes... We need to use BaseCompositeReader in the method signatures of our field data code instead of DirectoryReader.

Copy link
Member Author

Choose a reason for hiding this comment

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

@martijnvg since you know what needs to be done, can you open an issue for this? Then I can remove the comment and link to it so we don't forget to change this to include maybeWrap at some point

Copy link
Member

Choose a reason for hiding this comment

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

I opened: #23338

@cbuescher
Copy link
Member Author

@martijnvg thanks for the review, I added a commit that randomizes the test setup, unfortunately that required some more changes in the overall test structure (see follow up commit). Mind to take another quick look?

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM

@cbuescher cbuescher merged commit b9eb1bb into elastic:master Feb 24, 2017
@cbuescher
Copy link
Member Author

@martijnvg thanks

jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Feb 25, 2017
* master: (26 commits)
  CLI: Fix prompting for yes/no to handle console returning null (elastic#23320)
  Tests: Fix reproduce line for packagingTest (elastic#23365)
  Build: Remove extra copies of netty license (elastic#23361)
  [TEST] Removes timeout based wait_for_active_shards REST test (elastic#23360)
  [TEST] increase timeout slightly in wait_for_active_shards test to allow for index creation cluster state update to be processed before ensuring the wait times out
  Handle snapshot repository's missing index.latest
  Adding equals/hashCode to MainResponse (elastic#23352)
  Always restore the ThreadContext for operations delayed due to a block (elastic#23349)
  Add support for named xcontent parsers to high level REST client (elastic#23328)
  Add unit tests for ParentToChildAggregator (elastic#23305)
  Fix after last merge with master and apply last comments
  [INGEST] Lazy load the geoip databases.
  disable BWC tests for the highlighters, need a new 5.x build to make it work
  Expose WordDelimiterGraphTokenFilter (elastic#23327)
  Test that buildCredentials returns correct clazz (elastic#23334)
  Add BreakIteratorBoundaryScanner support for FVH (elastic#23248)
  Prioritize listing index-N blobs over index.latest in reading snapshots (elastic#23333)
  Test: Fix hdfs test fixture setup on windows
  delete and index tests can share some part of the code
  Remove createSampleDocument method and use the sync'ed index method
  ...
cbuescher added a commit to cbuescher/elasticsearch that referenced this pull request Feb 28, 2017
Adds unit tests for the `children` aggregation.
This change also add the ability to mock Mapperservice in subtests of
AggregatorTestCase.
cbuescher added a commit that referenced this pull request Feb 28, 2017
Adds unit tests for the `children` aggregation.
This change also add the ability to mock Mapperservice in subtests of
AggregatorTestCase.
@cbuescher
Copy link
Member Author

Backported to 5.x with df5d1c2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >enhancement >test Issues or PRs that are addressing/adding tests v5.4.0 v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants