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

Use a handmade TestReferenceMultiSource in tests instead of a mock. #3586

Merged
merged 1 commit into from
Sep 19, 2017

Conversation

cmnbroad
Copy link
Collaborator

@cmnbroad cmnbroad commented Sep 18, 2017

I've had ConcurrentModificationExceptions several times when mocked ReferenceMultiSource objects are both mocked and broadcast (for example). Mocks appear to be mutated, even when the mocked object is immutable, so serialization can fail. This replaces the mock object with a faked one.

@droazen droazen self-requested a review September 18, 2017 19:09
// since in some cases they're used as a Spark broadcast variable. Mocks are mutated when they're
// accessed, which can result in ConcurrentModificationExceptions during serialization/broadcast.
// So we need to allow test code to create a subclass that provides a "fake" implementation of this
// class without actually being a mock.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment might be more appropriate in a test class -- here you should just document concisely why the default constructor is protected.

return true;
}

public SerializableFunction<GATKRead, SimpleInterval> getReferenceWindowFunction() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@Override

Copy link
Contributor

@droazen droazen left a comment

Choose a reason for hiding this comment

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

Two comments, then merge when ready

@codecov-io
Copy link

codecov-io commented Sep 18, 2017

Codecov Report

Merging #3586 into master will decrease coverage by 0.003%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##              master     #3586       +/-   ##
===============================================
- Coverage     79.736%   79.733%   -0.003%     
- Complexity     18147     18149        +2     
===============================================
  Files           1217      1217               
  Lines          66601     66602        +1     
  Branches       10429     10429               
===============================================
- Hits           53105     53104        -1     
- Misses          9289      9292        +3     
+ Partials        4207      4206        -1
Impacted Files Coverage Δ Complexity Δ
...ender/engine/datasources/ReferenceMultiSource.java 82.143% <100%> (+0.661%) 11 <1> (+1) ⬆️
...oadinstitute/hellbender/utils/gcs/BucketUtils.java 76.623% <0%> (-1.948%) 39% <0%> (ø)
...er/tools/spark/sv/discovery/AlignmentInterval.java 88.889% <0%> (+0.463%) 52% <0%> (+1%) ⬆️

@cmnbroad cmnbroad force-pushed the cn_remove_referencesource_mock branch from 8823dde to 7548ad0 Compare September 18, 2017 22:43
@cmnbroad cmnbroad merged commit 58108d0 into master Sep 19, 2017
@cmnbroad cmnbroad deleted the cn_remove_referencesource_mock branch September 19, 2017 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants