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

BaseWordCountMapReduceTest#testCombinerForDistributedReductionWithException doesn't actually test reduce exception

    XMLWordPrintable

Details

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

    Description

      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;
            }
         }
      

      Attachments

        Activity

          People

            vblagoje Vladimir Blagojevic (Inactive)
            wburns@redhat.com Will Burns
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: