swuferhong commented on code in PR #1452:
URL: https://github.com/apache/fluss/pull/1452#discussion_r2664605248


##########
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/procedure/FlinkProcedureITCase.java:
##########
@@ -460,6 +492,124 @@ void testAddAndRemoveServerTag(boolean upperCase) throws 
Exception {
         }
     }
 
+    @ParameterizedTest
+    @ValueSource(booleans = {true, false})
+    void testRebalance(boolean upperCase) throws Exception {
+        // first create some unbalance assignment table.
+        for (int i = 0; i < 10; i++) {
+            String tableName = "reblance_test_tab_" + i;
+            tEnv.executeSql(
+                    String.format(
+                            "create table %s (a int, b varchar, c bigint, d 
int ) "
+                                    + "with ('connector' = 'fluss', 
'table.generate-unbalance-table-assignment'='true')",
+                            tableName));
+            long tableId =
+                    admin.getTableInfo(TablePath.of(DEFAULT_DB, 
tableName)).get().getTableId();
+            FLUSS_CLUSTER_EXTENSION.waitUntilTableReady(tableId);
+        }
+
+        String rebalance =
+                String.format(
+                        upperCase
+                                ? "Call 
%s.sys.rebalance('REPLICA_DISTRIBUTION_GOAL;LEADER_DISTRIBUTION_GOAL', true)"
+                                : "Call 
%s.sys.rebalance('replica_distribution_goal;leader_distribution_goal', true)",
+                        CATALOG_NAME);
+        try (CloseableIterator<Row> rows = 
tEnv.executeSql(rebalance).collect()) {
+            List<String> actual =
+                    CollectionUtil.iteratorToList(rows).stream()
+                            .map(Row::toString)
+                            .collect(Collectors.toList());
+            assertThat(actual.size()).isGreaterThan(1);
+        }
+
+        // test cancel rebalance.
+        try (CloseableIterator<Row> listProceduresIterator =
+                tEnv.executeSql(String.format("Call 
%s.sys.cancel_rebalance()", CATALOG_NAME))
+                        .collect()) {
+            assertCallResult(listProceduresIterator, new String[] 
{"+I[success]"});

Review Comment:
   I change to create two table to decrease the running time.



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