Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Obey the tmpDir setting in several constructors that currently ignore it #826
Conversation
codecov-io
commented
Mar 16, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #826 +/- ##
===============================================
+ Coverage 64.916% 64.948% +0.031%
- Complexity 7200 7209 +9
===============================================
Files 527 527
Lines 31784 31784
Branches 5425 5424 -1
===============================================
+ Hits 20633 20643 +10
+ Misses 9016 9008 -8
+ Partials 2135 2133 -2
|
|
Hi @Lenbok - The fix looks good, but we'd like to have tests to verify these changes. Would you be able to add some getters on the writer for the properties such as tmpdir, maxRecordsInRam, etc., and then add some tests to verify that they're propagated from the factory to the writer instance for the affected code paths ? Thanks. |
|
@cmnbroad No problems, will do. |
|
@cmnbroad Added the accessors and augmented an existing helper method that is used for a couple of SAM and BAM writing tests to check the properties are passed into the writers. Also put a couple of getters on the factory as well. |
|
@cmnbroad status check? |
| + final File wontBeUsed = new File("wontBeUsed.tmp"); | ||
| + final int maxRecsInRam = 271828; | ||
| + factory.setMaxRecordsInRam(maxRecsInRam); | ||
| + factory.setTempDirectory(wontBeUsed); |
droazen
Apr 18, 2017
Contributor
Can you make a separate test case to test this functionality instead of modifying an existing one?
yfarjoun
requested changes
Apr 18, 2017
looks good to go except for the comment regarding the test case.
Lenbok
was assigned
by droazen
Apr 18, 2017
|
@yfarjoun Have pulled out a separate test case and rebased to current master. Should be good to go now. |
| + Assert.assertEquals(maxRecsInRam, ((SAMFileWriterImpl) writer).getMaxRecordsInRam()); | ||
| + Assert.assertEquals(wontBeUsed, ((SAMFileWriterImpl) writer).getTempDirectory()); | ||
| + } | ||
| + try (final SAMFileWriter writer = factory.makeSAMWriter(header, false, new ByteArrayOutputStream())) { |
Lenbok
Apr 18, 2017
Contributor
Notice that one is testing SAM, and one is testing BAM. It didn't seem worth pulling out the two duplicated assertions to a separate method.
| + Assert.assertEquals(maxRecsInRam, ((SAMFileWriterImpl) writer).getMaxRecordsInRam()); | ||
| + Assert.assertEquals(wontBeUsed, ((SAMFileWriterImpl) writer).getTempDirectory()); | ||
| + } | ||
| + try (final SAMFileWriter writer = factory.makeSAMWriter(header, false, new ByteArrayOutputStream())) { |
|
|
Lenbok commentedMar 16, 2017
•
edited
Description
Several constructors don't do what they should regarding tmpDir.
Ensured that both initWriter and initializeBAMWriter both call setTempDirectory() when needed, and made one of the existing constructors make use of initWriter() (This private method had an unused parameter, which has been removed)
We encountered this by running out of disk space while sorting a file during output.
Checklist