wuchong commented on a change in pull request #14725:
URL: https://github.com/apache/flink/pull/14725#discussion_r582689059
##########
File path:
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/cli/CliClientTest.java
##########
@@ -258,6 +258,31 @@ public void testUseDatabaseAndShowCurrentDatabase() throws
Exception {
assertTrue(output.contains("db"));
}
+ @Test
+ public void testUseDatabaseAndShowCurrentDatabaseByKeyword() throws
Exception {
+ TestingExecutor executor = new TestingExecutorBuilder()
+ .setExecuteSqlConsumer((ignored1, sql) -> {
+ if (sql.toLowerCase().equals("use `mod`")) {
+ return TestTableResult.TABLE_RESULT_OK;
+ } else if (sql.toLowerCase().equals("show current
database")) {
+ SHOW_ROW.setField(0, "`mod`");
+ return new
TestTableResult(ResultKind.SUCCESS_WITH_CONTENT,
+ TableSchema.builder().field("current database
name", DataTypes.STRING()).build(),
+ CloseableIterator.ofElement(SHOW_ROW, ele ->
{}));
+ } else {
+ throw new SqlExecutionException("unexpected database
name: db");
+ }
+ })
+ .build();
+ String output = testExecuteSql(executor, "use `mod`;");
+ assertThat(executor.getNumExecuteSqlCalls(), is(1));
+ assertFalse(output.contains("OK"));
Review comment:
Should be `assertFalse(output.contains("unexpected database name"));`.
This test can pass even if we don't fix `CliClient`.
----------------------------------------------------------------
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]