File tree 1 file changed +6
-3
lines changed
flink-dstl/flink-dstl-dfs/src/test/java/org/apache/flink/changelog/fs
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 24
24
import org .apache .flink .util .function .RunnableWithException ;
25
25
import org .apache .flink .util .function .ThrowingConsumer ;
26
26
27
- import org .assertj .core .data .Percentage ;
28
27
import org .junit .jupiter .api .Test ;
29
28
30
29
import java .io .IOException ;
@@ -69,7 +68,7 @@ void testFixedRetryLimit() throws Exception {
69
68
70
69
@ Test
71
70
void testDiscardOnTimeout () throws Exception {
72
- int timeoutMs = 5 ;
71
+ int timeoutMs = 50 ; // should be long enough for the last attempt to succeed
73
72
int numAttempts = 7 ;
74
73
int successfulAttempt = numAttempts - 1 ;
75
74
List <Integer > completed = new CopyOnWriteArrayList <>();
@@ -123,7 +122,11 @@ public void handleFailure(Throwable throwable) {
123
122
Thread .sleep (10 );
124
123
}
125
124
}
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
+ }
127
130
assertThat (singletonList (successfulAttempt )).isEqualTo (completed );
128
131
assertThat (IntStream .range (0 , successfulAttempt ).boxed ().collect (toList ()))
129
132
.isEqualTo (discarded .stream ().sorted ().collect (toList ()));
You can’t perform that action at this time.
0 commit comments