yuxiqian commented on code in PR #3396:
URL: https://github.com/apache/flink-cdc/pull/3396#discussion_r1630490401
##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/testutils/UniqueDatabase.java:
##########
Review Comment:
Generally I would prefer not to change `UniqueDatabase`, and some
alternative approaches are 1) Keep using UniqueDatabase to test identical DB
and table name scenario, create tables during tests or 2) Create another class
like `CustomDatabase` which allows specifying database name directly without
appending suffix. Looking forward to hearing @qg-lin's thoughts.
##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-mysql-cdc/src/test/java/org/apache/flink/cdc/connectors/mysql/testutils/UniqueDatabase.java:
##########
@@ -58,10 +62,19 @@ public class UniqueDatabase {
public UniqueDatabase(
MySqlContainer container, String databaseName, String username,
String password) {
+ this(container, databaseName, getIdentifier(), username, password);
+ }
+
+ public UniqueDatabase(
+ MySqlContainer container,
+ String databaseName,
+ String username,
+ String password,
+ boolean withIdentifier) {
this(
container,
databaseName,
- Integer.toUnsignedString(new Random().nextInt(), 36),
+ withIdentifier ? getIdentifier() : StringUtils.EMPTY,
Review Comment:
The identifier suffix is meant to avoid test case conflicts since multiple
cases might run simultaneously on a single MySQL database instance. It should
be fine now since there's only one test case using this class, but might cause
trouble in the future if more testcases are added.
--
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]