swuferhong commented on code in PR #1452:
URL: https://github.com/apache/fluss/pull/1452#discussion_r2664599928
##########
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);
Review Comment:
I change to:
```
assertThat(actual.size()).isGreaterThan(2);
assertThat(actual.get(0)).startsWith("+I[Rebalance id:");
assertThat(actual.get(1)).isEqualTo("+I[Detail rebalance
plan:]");
for (int i = 2; i < actual.size(); i++) {
assertThat(actual.get(i)).startsWith("+I[RebalancePlanForBucket{tableBucket=");
}
```
--
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]