dawidwys commented on a change in pull request #17253:
URL: https://github.com/apache/flink/pull/17253#discussion_r723934098
##########
File path:
flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/tasks/StreamTaskTestHarness.java
##########
@@ -324,16 +324,19 @@ public void waitForTaskCompletion(long timeout) throws
Exception {
*
* @param timeout Timeout for the task completion
*/
- public void waitForTaskCompletion(long timeout, boolean
ignoreCancellationException)
- throws Exception {
+ public void waitForTaskCompletion(
+ long timeout, boolean ignoreCancellationOrInterruptedException)
throws Exception {
Preconditions.checkState(taskThread != null, "Task thread was not
started.");
taskThread.join(timeout);
if (taskThread.getError() != null) {
- if (!ignoreCancellationException
- || !ExceptionUtils.findThrowable(
- taskThread.getError(),
CancelTaskException.class)
- .isPresent()) {
+ boolean errorIsCancellationOrInterrupted =
+ ExceptionUtils.findThrowable(taskThread.getError(),
CancelTaskException.class)
+ .isPresent()
+ || ExceptionUtils.findThrowable(
+ taskThread.getError(),
InterruptedException.class)
+ .isPresent();
+ if (!ignoreCancellationOrInterruptedException ||
!errorIsCancellationOrInterrupted) {
Review comment:
nit: Could we revert the condition? I find way easier to reason without
negations:
```
if (ignoreCancellationOrInterruptedException &&
errorIsCancellationOrInterrupted) {
return;
}
throw new Exception("error in task", taskThread.getError());
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]