This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a commit to branch release-1.13
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.13 by this push:
new dcf9286 [FLINK-21879][tests] Harden
ActiveResourceManagerTest.testWorkerRegistrationTimeoutNotCountingAllocationTime
dcf9286 is described below
commit dcf9286b9ce8c8beeb66b0f27340cc2cd0b5d1d4
Author: Till Rohrmann <[email protected]>
AuthorDate: Thu Apr 1 22:09:03 2021 +0200
[FLINK-21879][tests] Harden
ActiveResourceManagerTest.testWorkerRegistrationTimeoutNotCountingAllocationTime
Hardens the
ActiveResourceManagerTest.testWorkerRegistrationTimeoutNotCountingAllocationTime
by introducing
the assumption that the registration is faster than the start worker
timeout.
This closes #15474.
---
.../resourcemanager/active/ActiveResourceManagerTest.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git
a/flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManagerTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManagerTest.java
index 303b57d..0c1ed19 100644
---
a/flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManagerTest.java
+++
b/flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/active/ActiveResourceManagerTest.java
@@ -66,6 +66,7 @@ import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
/** Tests for {@link ActiveResourceManager}. */
public class ActiveResourceManagerTest extends TestLogger {
@@ -782,11 +783,19 @@ public class ActiveResourceManagerTest extends TestLogger
{
fail();
}
+ final long start = System.nanoTime();
+
runInMainThread(() ->
requestResourceFuture.complete(tmResourceId));
// worker registered, verify not released due to
timeout
CompletableFuture<RegistrationResponse>
registerTaskExecutorFuture =
registerTaskExecutor(tmResourceId);
+
+ final long registrationTime = (System.nanoTime() -
start) / 1_000_000;
+
+ assumeTrue(
+ "The registration must not take longer
than the start worker timeout. If it does, then this indicates a very slow
machine.",
+ registrationTime <
TESTING_START_WORKER_TIMEOUT_MS);
assertThat(
registerTaskExecutorFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS),
instanceOf(RegistrationResponse.Success.class));