This is an automated email from the ASF dual-hosted git repository.

dwysakowicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit f070f0d9ae19275b1e32c2587209d7d8ae87b57e
Author: Anton Kalashnikov <kaa....@yandex.ru>
AuthorDate: Thu Oct 21 16:59:18 2021 +0200

    [FLINK-24331][tests] Forbid to finish the TestEventSource if it has not 
sent at least one value
---
 .../flink/runtime/operators/lifecycle/graph/TestEventSource.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/flink-tests/src/test/java/org/apache/flink/runtime/operators/lifecycle/graph/TestEventSource.java
 
b/flink-tests/src/test/java/org/apache/flink/runtime/operators/lifecycle/graph/TestEventSource.java
index 0d32de9..1badb6a 100644
--- 
a/flink-tests/src/test/java/org/apache/flink/runtime/operators/lifecycle/graph/TestEventSource.java
+++ 
b/flink-tests/src/test/java/org/apache/flink/runtime/operators/lifecycle/graph/TestEventSource.java
@@ -73,7 +73,8 @@ class TestEventSource extends 
RichSourceFunction<TestDataElement>
     public void run(SourceContext<TestDataElement> ctx) {
         long lastSent = 0;
         while (isRunning) {
-            TestCommand cmd = scheduledCommands.poll();
+            // Don't finish the source if it has not sent at least one value.
+            TestCommand cmd = lastSent == 0 ? null : scheduledCommands.poll();
             if (cmd == FINISH_SOURCES) {
                 ack(cmd);
                 isRunning = false;

Reply via email to