This is an automated email from the ASF dual-hosted git repository.
mapohl pushed a commit to branch release-1.18
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.18 by this push:
new 7eedd4238e1 [FLINK-33116][tests] Fix
CliClientTest.testCancelExecutionInteractiveMode fails with NPE
7eedd4238e1 is described below
commit 7eedd4238e107c3991139c6ce6aac7d2b3b956d8
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 5cf6b527a6c..f2920c21d18 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.api.common.JobID;
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.table.api.DataTypes;
import org.apache.flink.table.api.ResultKind;
@@ -294,14 +295,13 @@ class CliClientTest {
try (Terminal terminal = TerminalUtils.createDumbTerminal(inputStream,
outputStream);
CliClient client =
new CliClient(() -> terminal, 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) {
@@ -311,6 +311,8 @@ class CliClientTest {
terminal.raise(Terminal.Signal.INT);
CommonTestUtils.waitUntilCondition(
() ->
outputStream.toString().contains(CliStrings.MESSAGE_HELP));
+ // Prevent NPE when closing the terminal. See FLINK-33116 for more
information.
+ thread.sync();
}
}