Skip to content

Commit 7d6cdc5

Browse files
committed
[FLINK-26515][tests] Tolerate TimeoutException in RetryingExecutorTest.testDiscardOnTimeout
1 parent fc60d17 commit 7d6cdc5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

flink-dstl/flink-dstl-dfs/src/test/java/org/apache/flink/changelog/fs/RetryingExecutorTest.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.apache.flink.util.function.RunnableWithException;
2525
import org.apache.flink.util.function.ThrowingConsumer;
2626

27-
import org.assertj.core.data.Percentage;
2827
import org.junit.jupiter.api.Test;
2928

3029
import java.io.IOException;
@@ -69,7 +68,7 @@ void testFixedRetryLimit() throws Exception {
6968

7069
@Test
7170
void testDiscardOnTimeout() throws Exception {
72-
int timeoutMs = 5;
71+
int timeoutMs = 50; // should be long enough for the last attempt to succeed
7372
int numAttempts = 7;
7473
int successfulAttempt = numAttempts - 1;
7574
List<Integer> completed = new CopyOnWriteArrayList<>();
@@ -123,7 +122,11 @@ public void handleFailure(Throwable throwable) {
123122
Thread.sleep(10);
124123
}
125124
}
126-
assertThat(unexpectedException).hasValue(null);
125+
if (unexpectedException.get() != null) {
126+
// the last attempt might still timeout if the worker node is overloaded
127+
// and the thread is unscheduled for more than timeoutMs
128+
assertThat(unexpectedException).isInstanceOf(TimeoutException.class);
129+
}
127130
assertThat(singletonList(successfulAttempt)).isEqualTo(completed);
128131
assertThat(IntStream.range(0, successfulAttempt).boxed().collect(toList()))
129132
.isEqualTo(discarded.stream().sorted().collect(toList()));

0 commit comments

Comments
 (0)