Skip to content

Commit a5f8680

Browse files
committed
fix copilot comment
Signed-off-by: Pei Yu <125331682@qq.com>
1 parent 189b838 commit a5f8680

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-mysql/src/test/java/org/apache/flink/cdc/connectors/mysql/source/MySqlTableIdCaseInsensitveITCase.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,43 @@ public void testParseAlterStatementWhenTableNameAndColumnIsUpper(String tableNam
150150
assertThat(actual).isEqualTo(expected);
151151
}
152152

153+
@ParameterizedTest
154+
@ValueSource(strings = {"products", "uppercase_products"})
155+
public void testSnapshotModeWhenTableNameAndColumnIsUpper(String tableName)
156+
throws Exception {
157+
env.setParallelism(1);
158+
inventoryDatabase.createAndInitialize();
159+
MySqlSourceConfigFactory configFactory =
160+
new MySqlSourceConfigFactory()
161+
.hostname(MYSQL8_CONTAINER.getHost())
162+
.port(MYSQL8_CONTAINER.getDatabasePort())
163+
.username(TEST_USER)
164+
.password(TEST_PASSWORD)
165+
.databaseList(inventoryDatabase.getDatabaseName())
166+
.tableList(inventoryDatabase.getDatabaseName() + "\\." + tableName)
167+
.startupOptions(StartupOptions.snapshot())
168+
.serverId(getServerId(env.getParallelism()))
169+
.serverTimeZone("UTC")
170+
.includeSchemaChanges(SCHEMA_CHANGE_ENABLED.defaultValue());
171+
172+
FlinkSourceProvider sourceProvider =
173+
(FlinkSourceProvider) new MySqlDataSource(configFactory).getEventSourceProvider();
174+
CloseableIterator<Event> events =
175+
env.fromSource(
176+
sourceProvider.getSource(),
177+
WatermarkStrategy.noWatermarks(),
178+
MySqlDataSourceFactory.IDENTIFIER,
179+
new EventTypeInfo())
180+
.executeAndCollect();
181+
Thread.sleep(5_000);
182+
183+
TableId tableId = TableId.tableId(inventoryDatabase.getDatabaseName(), tableName);
184+
List<Event> expected = new ArrayList<>();
185+
expected.add(getProductsCreateTableEvent(tableId));
186+
List<Event> actual = fetchResults(events, expected.size());
187+
assertThat(actual).isEqualTo(expected);
188+
}
189+
153190
private CreateTableEvent getProductsCreateTableEvent(TableId tableId) {
154191
return new CreateTableEvent(
155192
tableId,

flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-mysql/src/test/resources/ddl/inventory.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ VALUES (default,"scooter","Small 2-wheel scooter",3.14),
3434
(default,"hammer","14oz carpenter's hammer",0.875),
3535
(default,"hammer","16oz carpenter's hammer",1.0),
3636
(default,"rocks","box of assorted rocks",5.3),
37-
(default,"jacket","water resistent black wind breaker",0.1),
37+
(default,"jacket","water resistant black wind breaker",0.1),
3838
(default,"spare tire","24 inch spare tire",22.2);
3939

4040
-- Create a table where all fields are in uppercase.
@@ -54,7 +54,7 @@ VALUES (default,"scooter","Small 2-wheel scooter",3.14),
5454
(default,"hammer","14oz carpenter's hammer",0.875),
5555
(default,"hammer","16oz carpenter's hammer",1.0),
5656
(default,"rocks","box of assorted rocks",5.3),
57-
(default,"jacket","water resistent black wind breaker",0.1),
57+
(default,"jacket","water resistant black wind breaker",0.1),
5858
(default,"spare tire","24 inch spare tire",22.2);
5959

6060
-- Create some customers ...

0 commit comments

Comments
 (0)