Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-4544

BaseWordCountMapReduceTest#testCombinerForDistributedReductionWithException doesn't actually test reduce exception

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.CR2
    • 7.0.0.Alpha5
    • Clustered Executor
    • None

      When looking into serialization issues I found that many map reduce failures occur due to not serializable exceptions. Looking closer it appears this was caused by the testCombinerForDistributedReductionWithException method because the anonymous inner class cannot be serialized and throws a CacheException causing the test to pass. However if I pass in a serializable class the test fails because the Divide By Zero exception is swallowed incorrectly.

         @Test(expectedExceptions = CacheException.class)
         public void testCombinerForDistributedReductionWithException() throws Exception {
            MapReduceTask<String, String, String, Integer> task = invokeMapReduce(null);
            task.combinedWith(new DivideByZeroReducer());
      
            task.execute();
         }
      
         private static class DivideByZeroReducer implements Reducer<String, Integer>, Serializable {
            @Override
            public Integer reduce(String reducedKey, Iterator<Integer> iter) {
               //simulating exception
               int a = 4 / 0;
      
               return null;
            }
         }
      

              vblagoje Vladimir Blagojevic (Inactive)
              wburns@redhat.com Will Burns
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: