fsk119 commented on a change in pull request #15366:
URL: https://github.com/apache/flink/pull/15366#discussion_r603796892
##########
File path:
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
##########
@@ -134,58 +142,113 @@ public void testHistoryFile() throws Exception {
}
@Test
- public void verifyCancelSubmitInSyncMode() throws Exception {
- final MockExecutor mockExecutor = new MockExecutor(true);
- String sessionId = mockExecutor.openSession("test-session");
+ public void testGetEOFinInteractiveMode() throws Exception {
+ final List<String> statements =
+ Arrays.asList("DESC MyOtherTable;", "SHOW TABLES"); // meet EOF
+ String content = String.join("\n", statements);
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256);
-
- try (CliClient client =
- new CliClient(
- TerminalUtils.createDummyTerminal(outputStream),
- sessionId,
- mockExecutor,
- historyTempFile(),
- null)) {
- FutureTask<Boolean> task =
- new FutureTask<>(() ->
client.submitUpdate(INSERT_INTO_STATEMENT));
- Thread thread = new Thread(task);
- thread.start();
+ final MockExecutor mockExecutor = new MockExecutor();
- while (!mockExecutor.isAwait) {
- Thread.sleep(10);
- }
+ executeSqlFromContent(mockExecutor, content, true);
+ // don't execute the last commands
+ assertTrue(statements.get(0).contains(mockExecutor.receivedStatement));
+ }
- thread.interrupt();
- assertFalse(task.get());
- assertTrue(
- outputStream
- .toString()
- .contains("java.lang.InterruptedException: sleep
interrupted"));
- }
+ @Test
+ public void testGetEOFinNonInteractiveMode() throws Exception {
+ final List<String> statements =
+ Arrays.asList("DESC MyOtherTable;", "SHOW TABLES"); // meet EOF
Review comment:
I think we have reach the consenus about it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]