This is an automated email from the ASF dual-hosted git repository. chesnay pushed a commit to branch release-1.16 in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.16 by this push: new 0f52f62b189 [FLINK-30619][tests] Add retry 0f52f62b189 is described below commit 0f52f62b1891230308282e0b819062eb13eb5644 Author: Chesnay Schepler <ches...@apache.org> AuthorDate: Thu Jan 26 16:42:55 2023 +0100 [FLINK-30619][tests] Add retry --- .../runtime/scheduler/adaptive/AdaptiveSchedulerTest.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java index fee595c49d4..bedb12a20b3 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java @@ -87,6 +87,7 @@ import org.apache.flink.runtime.slots.ResourceRequirement; import org.apache.flink.runtime.state.KeyGroupRangeAssignment; import org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation; import org.apache.flink.runtime.taskmanager.TaskExecutionState; +import org.apache.flink.runtime.testutils.CommonTestUtils; import org.apache.flink.runtime.util.ResourceCounter; import org.apache.flink.runtime.util.TestingFatalErrorHandler; import org.apache.flink.testutils.TestingUtils; @@ -582,10 +583,7 @@ public class AdaptiveSchedulerTest extends TestLogger { // wait for the first task submission taskManagerGateway.waitForSubmissions(1, Duration.ofSeconds(5)); - // sleep a bit to ensure uptime is > 0 - Thread.sleep(10L); - - assertThat(upTimeGauge.getValue()).isGreaterThan(0L); + CommonTestUtils.waitUntilCondition(() -> upTimeGauge.getValue() > 0L); assertThat(downTimeGauge.getValue()).isEqualTo(0L); assertThat(restartTimeGauge.getValue()).isEqualTo(0L); @@ -602,10 +600,7 @@ public class AdaptiveSchedulerTest extends TestLogger { // wait for the second task submissions taskManagerGateway.waitForSubmissions(2, Duration.ofSeconds(5)); - // sleep a bit to ensure uptime is > 0 - Thread.sleep(10L); - - assertThat(upTimeGauge.getValue()).isGreaterThan(0L); + CommonTestUtils.waitUntilCondition(() -> upTimeGauge.getValue() > 0L); assertThat(downTimeGauge.getValue()).isEqualTo(0L); // can be zero if the restart is very quick assertThat(restartTimeGauge.getValue()).isGreaterThanOrEqualTo(0L);