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

mapohl 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 e1114181eeb [FLINK-33116][tests] Fix 
CliClientTest.testCancelExecutionInteractiveMode fails with NPE
e1114181eeb is described below

commit e1114181eeb766c0fb7aea9c8dfe14660c62aca0
Author: Jiabao Sun <[email protected]>
AuthorDate: Thu Oct 12 14:58:44 2023 +0800

    [FLINK-33116][tests] Fix CliClientTest.testCancelExecutionInteractiveMode 
fails with NPE
---
 .../apache/flink/table/client/cli/CliClientTest.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git 
a/flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
 
b/flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
index a1b6e0069f6..ade9c3467b9 100644
--- 
a/flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
+++ 
b/flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
@@ -21,6 +21,7 @@ package org.apache.flink.table.client.cli;
 import org.apache.flink.client.cli.DefaultCLI;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.core.testutils.CheckedThread;
 import org.apache.flink.runtime.testutils.CommonTestUtils;
 import org.apache.flink.streaming.environment.TestingJobClient;
 import org.apache.flink.table.api.DataTypes;
@@ -336,14 +337,13 @@ public class CliClientTest extends TestLogger {
                         mockExecutor,
                         historyFilePath,
                         null)) {
-            Thread thread =
-                    new Thread(
-                            () -> {
-                                try {
-                                    client.executeInInteractiveMode();
-                                } catch (Exception ignore) {
-                                }
-                            });
+            CheckedThread thread =
+                    new CheckedThread() {
+                        @Override
+                        public void go() {
+                            client.executeInInteractiveMode();
+                        }
+                    };
             thread.start();
 
             while (!mockExecutor.isAwait) {
@@ -353,6 +353,8 @@ public class CliClientTest extends TestLogger {
             client.getTerminal().raise(Terminal.Signal.INT);
             CommonTestUtils.waitUntilCondition(
                     () -> outputStream.toString().contains("'key' = 'value'"));
+            // Prevent NPE when closing the terminal. See FLINK-33116 for more 
information.
+            thread.sync();
         }
     }
 

Reply via email to