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

Splitting out gatk-testUtils as a separate artifact #5112

Merged
merged 5 commits into from
Aug 16, 2018

Conversation

lbergelson
Copy link
Member

this allows us to remove the compile time dependencies minicluster and testng and convert them to dependencies of this new artifact
moving utils.test package to testutils and a new source root

the new dependency structure looks like

main <- testUtils
^ ^
test

one side effect was that commons.math is no longer imported, we were accidentally using this in some places instead of commons.math3 which is what we wanted.

@lbergelson lbergelson requested a review from jamesemery August 14, 2018 20:41
@lbergelson lbergelson changed the title Splitting out gatk-test-utils as a separate artifact Splitting out gatk-testUtils as a separate artifact Aug 14, 2018
@lbergelson lbergelson requested a review from cmnbroad August 14, 2018 20:48
build.gradle Outdated
@@ -325,6 +336,12 @@ dependencies {
// Required for SV Discovery machine learning
compile group: 'biz.k11i', name: 'xgboost-predictor', version: '0.3.0'

testUtilsCompile sourceSets.main.output
testUtilsCompile 'org.testng:testng:' + testNGVersion //compile instead of testCompile because it is needed for test infrastructure that needs to be packaged
Copy link
Member Author

Choose a reason for hiding this comment

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

need to update this comment...

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@lbergelson
Copy link
Member Author

@jamesemery @cmnbroad This fixes a personal pet peeve of mine, which is that we're packaging a bunch of test classes as a runtime dependency. It splits out a new test artifact which contains just the classes in utils.test and allows it to be published and consumed separately from the rest of the gatk. This allows us to make testng and minicluster no longer compile dependencies

@codecov-io
Copy link

codecov-io commented Aug 14, 2018

Codecov Report

Merging #5112 into master will increase coverage by 0.145%.
The diff coverage is 50%.

@@               Coverage Diff               @@
##              master     #5112       +/-   ##
===============================================
+ Coverage     86.507%   86.652%   +0.145%     
+ Complexity     29260     28982      -278     
===============================================
  Files           1814      1799       -15     
  Lines         135635    134495     -1140     
  Branches       15063     14924      -139     
===============================================
- Hits          117334    116543      -791     
+ Misses         12833     12546      -287     
+ Partials        5468      5406       -62
Impacted Files Coverage Δ Complexity Δ
...ollectQualityYieldMetricsSparkIntegrationTest.java 100% <ø> (ø) 5 <0> (ø) ⬇️
...hellbender/tools/CountVariantsIntegrationTest.java 100% <ø> (ø) 4 <0> (ø) ⬇️
...ne/spark/datasources/ReadsSparkSourceUnitTest.java 91.852% <ø> (ø) 25 <0> (ø) ⬇️
...ExampleReadWalkerWithReferenceIntegrationTest.java 100% <ø> (ø) 3 <0> (ø) ⬇️
...park/pipelines/PrintReadsSparkIntegrationTest.java 88.293% <ø> (ø) 30 <0> (ø) ⬇️
...ls/genomicsdb/GenomicsDBImportIntegrationTest.java 89.356% <ø> (ø) 73 <0> (ø) ⬇️
...ls/CalculateGenotypePosteriorsIntegrationTest.java 95.082% <ø> (ø) 13 <0> (ø) ⬇️
...er/tools/funcotator/FuncotatorIntegrationTest.java 84.305% <ø> (ø) 72 <0> (ø) ⬇️
...bender/tools/walkers/qc/PileupIntegrationTest.java 90.476% <ø> (ø) 6 <0> (ø) ⬇️
.../PathSeqBuildReferenceTaxonomyIntegrationTest.java 87.273% <ø> (ø) 8 <0> (ø) ⬇️
... and 210 more

Copy link
Collaborator

@cmnbroad cmnbroad left a comment

Choose a reason for hiding this comment

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

Glad we're doing this - just a couple of questions/suggestions.

build.gradle Outdated
testUtils
}

configurations {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor question - is there any significance to the fact that this configurations closure is separate from the other one ? Can they be consolidated ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there is any significance, I'll combine them.

@@ -293,7 +295,9 @@ protected Process getProcess() {
public void terminate() {
if (dataTransferFIFOWriter != null) {
if (asyncWriter != null) {
Assert.assertTrue(asyncWriter.terminate());
if(!asyncWriter.terminate()){
throw new GATKException("failed to close asynWriter");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two comments:
1 Wow.
2) asynWriter -> asyncWriter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. It's easy to end up accidentally depending on things you don't want to be when they're in your classpath...

build.gradle Outdated
addFilter('gatk-test-utils') {artifact, file ->
artifact.name == 'gatk-test-utils'
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we factor this out into a named (def =) closure so it can be shared ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, done, although it doesn't save that much typing.

testUtilsCompile 'org.apache.hadoop:hadoop-minicluster:' + hadoopVersion

testCompile sourceSets.testUtils.output

testCompile "org.mockito:mockito-core:2.10.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can/should mockito be moved to testUtilsCompile ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It can, but there's no reason to do so. Nothing in testUtils uses it. We can move it when / if we need it. Best to keep dependencies scoped as narrowly as possible I think. Similar issue with jimfs. I suspect your ArgumentsBuilder branch will require jimfs to move to testUtils.

Copy link
Contributor

@magicDGS magicDGS left a comment

Choose a reason for hiding this comment

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

This is so cool!! Finally cleaning up the dependencies for test classes. Some comments and this should close #1481 and #3567

@@ -279,8 +290,6 @@ dependencies {
}

compile 'org.jgrapht:jgrapht-core:0.9.1'
compile 'org.testng:testng:' + testNGVersion //compile instead of testCompile because it is needed for test infrastructure that needs to be packaged
compile 'org.apache.hadoop:hadoop-minicluster:' + hadoopVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

Finally these two out of my toolkit dependencies!

Copy link
Member Author

Choose a reason for hiding this comment

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

:)

@@ -22,7 +23,6 @@
import org.broadinstitute.hellbender.utils.param.ParamUtils;
import org.broadinstitute.hellbender.utils.read.ReadUtils;
import org.broadinstitute.hellbender.utils.variant.GATKVariantContextUtils;
import org.testng.collections.Sets;
Copy link
Contributor

Choose a reason for hiding this comment

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

OMG!

@@ -1,4 +1,4 @@
package org.broadinstitute.hellbender.utils.test;
package org.broadinstitute.hellbender.testutils;
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be here, but should be a test in living in org.broadinstitute.hellbender.utils.help (no idea why it was here in the first place)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, good call, I didn't actually audit what these things are.

@@ -1,4 +1,4 @@
package org.broadinstitute.hellbender.utils.test;
package org.broadinstitute.hellbender.testutils;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be better moved to the funcotator package, as it isn't really related with testutils?

Copy link
Member Author

Choose a reason for hiding this comment

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

It has one method that's generally useful, maybe that should move but I'm going to leave it here for now.

@@ -1,4 +1,4 @@
package org.broadinstitute.hellbender.utils.test;
package org.broadinstitute.hellbender.testutils;
Copy link
Contributor

Choose a reason for hiding this comment

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

Integration test for help package. Same as DocumentationGenerationIntegrationTest

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call.

@@ -1,4 +1,4 @@
package org.broadinstitute.hellbender.utils.test.testers;
package org.broadinstitute.hellbender.testutils.testers;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this live in testutils or better in the markduplicate's related package?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, if anyone wants to make a new version of mark duplicates this might help. I'm going to leave it here for now.

@@ -1,4 +1,4 @@
package org.broadinstitute.hellbender.utils.test.testers;
package org.broadinstitute.hellbender.testutils.testers;
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR is a good place to fix the TODO on top of the class: this only tests one class and it is not part of the framework; it should be added to the GATK-test-sources. And actually it is testing a picard tool, so I am not sure if it is needed at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we can just delete this, it's unused.

this allows us to remove the compile time dependencies minicluster and testng and convert them to dependencies of this new artifact
moving utils.test package to testutils and a new source root

the new dependency structure looks like

main <- testUtils
  ^      ^
   test
Copy link
Collaborator

@jamesemery jamesemery left a comment

Choose a reason for hiding this comment

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

Can you check and see that all of the tests are being run now? I'm not sure i'm convinced these test classes have made it into the docker.

@lbergelson
Copy link
Member Author

Tests are run.

Copy link
Collaborator

@jamesemery jamesemery left a comment

Choose a reason for hiding this comment

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

Can you check and see that all of the tests are being run now? I'm not sure i'm convinced these test classes have made it into the docker. 👍

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.

5 participants