pnowojski commented on a change in pull request #12525:
URL: https://github.com/apache/flink/pull/12525#discussion_r442772501



##########
File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
##########
@@ -207,9 +209,8 @@ public void testCleanUpExceptionSuppressing() throws 
Exception {
                        testHarness.waitForTaskCompletion();
                }
                catch (Exception ex) {
-                       if (!ExceptionUtils.findThrowable(ex, 
ExpectedTestException.class).isPresent()) {
-                               throw ex;
-                       }
+                       assertTrue(ex.getCause() instanceof 
ExpectedTestException);

Review comment:
       nit: Unless there is some good reason 
   `(!ExceptionUtils.findThrowable(ex, 
ExpectedTestException.class).isPresent())` is better to have compared to 
`ex.getCause() instanceof ExpectedTestException`. This good reason might be 
that you want to ensure and make it part of the contract, that the original 
exception is not wrapped - if that's the intention, feel free to ignore this 
comment :)

##########
File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTest.java
##########
@@ -207,9 +209,8 @@ public void testCleanUpExceptionSuppressing() throws 
Exception {
                        testHarness.waitForTaskCompletion();
                }
                catch (Exception ex) {
-                       if (!ExceptionUtils.findThrowable(ex, 
ExpectedTestException.class).isPresent()) {
-                               throw ex;
-                       }
+                       assertTrue(ex.getCause() instanceof 
ExpectedTestException);
+                       
assertTrue(Iterables.getOnlyElement(asList(ex.getCause().getSuppressed())) 
instanceof FailingTwiceOperator.DisposeException);

Review comment:
       The previous construct that was checking if the exception as as expected 
and if not, rethrowing this unexpected exception was by design and intentional 
- if test fails because of some unexpected exception, it greatly speeds up 
figuring out what has failed, especially if that's a flaky failure.
   
   Could this functionality be preserved? Replace `assertTrue(condition)` with 
`if (!condition) { throw ex; }`?
   
   Sorry for nit picking on this and adding one more review round, but we (me 
personally included) wasted quite a bit of time because of this issue in 
various tests :(




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to