On the way to really sorting out HMS error handling

-- Better error message when a traveral error occurs (a real bug)
-- EngineFeaturesIntegrationTest runs the multi-threaded error testing routines 50x times
-- A bit of cleanup in WalkerTest
This commit is contained in:
Mark DePristo 2012-07-25 22:11:10 -04:00
parent 5671992db3
commit 9242f63a4d
3 changed files with 13 additions and 11 deletions

View File

@ -358,7 +358,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
if (error instanceof RuntimeException)
this.error = (RuntimeException)error;
else
this.error = new ReviewedStingException("An error occurred during the traversal.", error);
this.error = new ReviewedStingException("An error occurred during the traversal. Message=" + error.getMessage(), error);
}

View File

@ -169,7 +169,6 @@ public class WalkerTest extends BaseTest {
Class expectedException = null;
boolean includeImplicitArgs = true;
boolean includeShadowBCF = true;
boolean repairHeader = false;
// the default output path for the integration test
private File outputFileLocation = null;
@ -211,8 +210,6 @@ public class WalkerTest extends BaseTest {
String.format(" -et %s -K %s ", GATKRunReport.PhoneHomeOption.NO_ET, gatkKeyFile));
if ( includeShadowBCF && GENERATE_SHADOW_BCF )
args = args + " --generateShadowBCF ";
if ( repairHeader )
args = args + " --repairVCFHeader public/data/vcfHeaderForRepairs.vcf ";
}
return args;
@ -224,7 +221,6 @@ public class WalkerTest extends BaseTest {
* which will ultimately blow up...
*/
public void disableShadowBCF() { this.includeShadowBCF = false; }
public void repairHeaders() { this.repairHeader = true; }
public void setOutputFileLocation(File outputFileLocation) {
this.outputFileLocation = outputFileLocation;
}
@ -367,10 +363,16 @@ public class WalkerTest extends BaseTest {
// it's the type we expected
//System.out.println(String.format(" => %s PASSED", name));
} else {
if ( e.getCause() != null )
e.getCause().printStackTrace(System.out); // must print to stdout to see the message
Assert.fail(String.format("Test %s expected exception %s but instead got %s with error message %s",
name, expectedException, e.getClass(), e.getMessage()));
final String message = String.format("Test %s expected exception %s but instead got %s with error message %s",
name, expectedException, e.getClass(), e.getMessage());
if ( e.getCause() != null ) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final PrintStream ps = new PrintStream(baos);
e.getCause().printStackTrace(ps);
BaseTest.log(message);
BaseTest.log(baos.toString());
}
Assert.fail(message);
}
} else {
// we didn't expect an exception but we got one :-(

View File

@ -90,7 +90,7 @@ public class EngineFeaturesIntegrationTest extends WalkerTest {
super(EngineErrorHandlingTestProvider.class);
this.expectedException = exceptedException;
this.multiThreaded = multiThreaded;
this.iterationsToTest = multiThreaded ? 10 : 1;
this.iterationsToTest = multiThreaded ? 50 : 1;
setName(String.format("Engine error handling: expected %s, is-multithreaded %b", exceptedException, multiThreaded));
}
}
@ -110,7 +110,7 @@ public class EngineFeaturesIntegrationTest extends WalkerTest {
// Loop over errors to throw, make sure they are the errors we get back from the engine, regardless of NT type
//
@Test(dataProvider = "EngineErrorHandlingTestProvider")
public void testEngineErrorHandlingTestProvider(EngineErrorHandlingTestProvider cfg) {
public void testEngineErrorHandlingTestProvider(final EngineErrorHandlingTestProvider cfg) {
for ( int i = 0; i < cfg.iterationsToTest; i++ ) {
final String root = "-T ErrorThrowing -R " + b37KGReference;
final String args = root + (cfg.multiThreaded ? " -nt 2" : "") + " -E " + cfg.expectedException.getSimpleName();