-
Notifications
You must be signed in to change notification settings - Fork 593
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
Conversation
// 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. |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Override
There was a problem hiding this 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 Report
@@ 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
|
8823dde
to
7548ad0
Compare
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.