snuyanzin commented on code in PR #28793:
URL: https://github.com/apache/flink/pull/28793#discussion_r3658664689


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/batch/sql/CreateConnectionITCase.java:
##########
@@ -73,6 +73,36 @@ void 
testCreatePermanentConnectionRejectedWithoutSecretStore() {
                 .hasMessageContaining("WritableSecretStore must be 
configured");
     }
 
+    @Test
+    void testAlterConnectionRenameTemporaryConnection() {
+        tEnv().executeSql("CREATE TEMPORARY CONNECTION my_conn WITH ('k' = 
'v')");
+
+        tEnv().executeSql("ALTER CONNECTION my_conn RENAME TO new_conn");
+
+        
assertThat(catalogManager().getConnection(connectionIdentifier("my_conn"))).isEmpty();
+        
assertThat(catalogManager().getConnection(connectionIdentifier("new_conn")))
+                .hasValueSatisfying(
+                        connection ->
+                                
assertThat(connection.getOptions()).containsOnly(entry("k", "v")));
+    }
+
+    @Test
+    void testAlterConnectionRenameIfExists() {
+        tEnv().executeSql("ALTER CONNECTION IF EXISTS missing_conn RENAME TO 
new_conn");
+
+        
assertThat(catalogManager().getConnection(connectionIdentifier("new_conn"))).isEmpty();
+    }
+
+    @Test
+    void testAlterConnectionRenameToExistingConnectionRejected() {
+        tEnv().executeSql("CREATE TEMPORARY CONNECTION my_conn WITH ('k' = 
'v')");
+        tEnv().executeSql("CREATE TEMPORARY CONNECTION new_conn WITH ('k' = 
'v')");

Review Comment:
   what will happen if there is a temporary connection and we create a non 
temporary connection?
   and vice versa?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to