Repository: accumulo Updated Branches: refs/heads/master b0d1d291c -> 99820faf4
ACCUMULO-3871 handle some error cases: empty file name, base classes w/no tests, long running Test class with many shorter tests Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/99820faf Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/99820faf Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/99820faf Branch: refs/heads/master Commit: 99820faf4665941927ff795f92988048c0ca6c2f Parents: b0d1d29 Author: Eric Newton <eric.new...@gmail.com> Authored: Thu Jun 4 09:41:19 2015 -0400 Committer: Eric Newton <eric.new...@gmail.com> Committed: Thu Jun 4 09:41:19 2015 -0400 ---------------------------------------------------------------------- .../accumulo/test/IntegrationTestMapReduce.java | 27 ++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/99820faf/test/src/test/java/org/apache/accumulo/test/IntegrationTestMapReduce.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/IntegrationTestMapReduce.java b/test/src/test/java/org/apache/accumulo/test/IntegrationTestMapReduce.java index 42c1095..e33f3a9 100644 --- a/test/src/test/java/org/apache/accumulo/test/IntegrationTestMapReduce.java +++ b/test/src/test/java/org/apache/accumulo/test/IntegrationTestMapReduce.java @@ -47,8 +47,11 @@ public class IntegrationTestMapReduce extends Configured implements Tool { public static class TestMapper extends Mapper<LongWritable,Text,IntWritable,Text> { @Override - protected void map(LongWritable key, Text value, Mapper<LongWritable,Text,IntWritable,Text>.Context context) throws IOException, InterruptedException { + protected void map(LongWritable key, Text value, final Mapper<LongWritable,Text,IntWritable,Text>.Context context) throws IOException, InterruptedException { String className = value.toString(); + if (className.trim().isEmpty()) { + return; + } Class<? extends Object> test = null; try { test = Class.forName(className); @@ -63,27 +66,35 @@ public class IntegrationTestMapReduce extends Configured implements Tool { @Override public void testStarted(Description description) throws Exception { log.info("Starting {}", description); + context.progress(); } @Override public void testFinished(Description description) throws Exception { log.info("Finished {}", description); + context.progress(); } @Override public void testFailure(Failure failure) throws Exception { log.info("Test failed: {}", failure.getDescription(), failure.getException()); + context.progress(); } }); log.info("Running test {}", className); - Result result = core.run(test); - if (result.wasSuccessful()) { - log.info("{} was successful", className); - context.write(new IntWritable(0), value); - } else { - log.info("{} failed", className); - context.write(new IntWritable(1), value); + try { + Result result = core.run(test); + if (result.wasSuccessful()) { + log.info("{} was successful", className); + context.write(new IntWritable(0), value); + } else { + log.info("{} failed", className); + context.write(new IntWritable(1), value); + } + } catch (Exception e) { + // most likely JUnit issues, like no tests to run + log.info("Test failed: {}", className, e); } } }