You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2023/02/07 14:15:39 UTC
[flink] branch master updated: [FLINK-30910][runtime] Making test wait for stop to be called before finishing the bootstrap operation (#21869)
This is an automated email from the ASF dual-hosted git repository.
mapohl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new a6de5f23a30 [FLINK-30910][runtime] Making test wait for stop to be called before finishing the bootstrap operation (#21869)
a6de5f23a30 is described below
commit a6de5f23a30fcd580f4d005ade0fb2eba0e901dc
Author: Matthias Pohl <ma...@aiven.io>
AuthorDate: Tue Feb 7 15:15:31 2023 +0100
[FLINK-30910][runtime] Making test wait for stop to be called before finishing the bootstrap operation (#21869)
This change prevents a race condition where the bootstrap
process finishes before the test calls stop which results
in an outcome that's not expected in this test.
Signed-off-by: Matthias Pohl <ma...@aiven.io>
---
.../application/ApplicationDispatcherBootstrapTest.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/flink-clients/src/test/java/org/apache/flink/client/deployment/application/ApplicationDispatcherBootstrapTest.java b/flink-clients/src/test/java/org/apache/flink/client/deployment/application/ApplicationDispatcherBootstrapTest.java
index fa35fb95c17..2028a6caa34 100644
--- a/flink-clients/src/test/java/org/apache/flink/client/deployment/application/ApplicationDispatcherBootstrapTest.java
+++ b/flink-clients/src/test/java/org/apache/flink/client/deployment/application/ApplicationDispatcherBootstrapTest.java
@@ -46,6 +46,7 @@ import org.apache.flink.util.FlinkException;
import org.apache.flink.util.FlinkRuntimeException;
import org.apache.flink.util.SerializedThrowable;
import org.apache.flink.util.concurrent.FutureUtils;
+import org.apache.flink.util.concurrent.ManuallyTriggeredScheduledExecutor;
import org.apache.flink.util.concurrent.ScheduledExecutor;
import org.apache.flink.util.concurrent.ScheduledExecutorServiceAdapter;
@@ -331,6 +332,8 @@ class ApplicationDispatcherBootstrapTest {
return CompletableFuture.completedFuture(Acknowledge.get());
});
+ final ManuallyTriggeredScheduledExecutor manuallyTriggeredExecutor =
+ new ManuallyTriggeredScheduledExecutor();
// we're "listening" on this to be completed to verify that the error handler is called.
// In production, this will shut down the cluster with an exception.
final CompletableFuture<Void> errorHandlerFuture = new CompletableFuture<>();
@@ -338,7 +341,7 @@ class ApplicationDispatcherBootstrapTest {
createApplicationDispatcherBootstrap(
3,
dispatcherBuilder.build(),
- scheduledExecutor,
+ manuallyTriggeredExecutor,
errorHandlerFuture::completeExceptionally);
final CompletableFuture<Acknowledge> completionFuture =
@@ -348,6 +351,11 @@ class ApplicationDispatcherBootstrapTest {
bootstrap.stop();
+ // Triggers the scheduled ApplicationDispatcherBootstrap process after calling stop. This
+ // ensures that the bootstrap task isn't completed before the stop method is called which
+ // would prevent the stop call from cancelling the task's future.
+ manuallyTriggeredExecutor.triggerNonPeriodicScheduledTask();
+
// we didn't call the error handler
assertThat(errorHandlerFuture.isDone()).isFalse();