This is an automated email from the ASF dual-hosted git repository.
menghaoranss pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 9330549f880 Add regression coverage for MySQL Proxy table name casing
(#39884)
9330549f880 is described below
commit 9330549f8801b6e9355046faabb5d5457d2634dc
Author: Haoran Meng <[email protected]>
AuthorDate: Fri Sep 18 14:18:37 2026 +0800
Add regression coverage for MySQL Proxy table name casing (#39884)
---
.../executor/show/MySQLShowTablesExecutorTest.java | 26 ++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowTablesExecutorTest.java
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowTablesExecutorTest.java
index 4ce187506b7..76083012a7e 100644
---
a/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowTablesExecutorTest.java
+++
b/proxy/backend/dialect/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/show/MySQLShowTablesExecutorTest.java
@@ -39,6 +39,9 @@ import
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.Iden
import
org.apache.shardingsphere.sql.parser.statement.mysql.dal.show.table.MySQLShowTablesStatement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
@@ -54,6 +57,7 @@ import java.util.Properties;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -156,6 +160,28 @@ class MySQLShowTablesExecutorTest {
assertFalse(executor.getMergedResult().next());
}
+ @ParameterizedTest(name = "{0}")
+ @MethodSource("mixedCaseTableStatements")
+ void assertShowTablesWithMixedCaseTable(final String name, final
MySQLShowTablesStatement sqlStatement, final int expectedColumnCount) throws
SQLException {
+ MySQLShowTablesExecutor executor = new
MySQLShowTablesExecutor(sqlStatement);
+ ShardingSphereTable table = new
ShardingSphereTable("foo_order_FEDERATE", Collections.emptyList(),
Collections.emptyList(), Collections.emptyList());
+ executor.execute(mockConnectionSession(),
mockMetaData(mockDatabases(Collections.singleton(table))));
+ assertThat(executor.getQueryResultMetaData().getColumnCount(),
is(expectedColumnCount));
+ assertTrue(executor.getMergedResult().next());
+ assertThat(executor.getMergedResult().getValue(1, Object.class),
is("foo_order_FEDERATE"));
+ assertFalse(executor.getMergedResult().next());
+ }
+
+ private static Collection<Arguments> mixedCaseTableStatements() {
+ DatabaseType databaseType =
TypedSPILoader.getService(DatabaseType.class, "MySQL");
+ ShowFilterSegment filter = mock(ShowFilterSegment.class);
+ when(filter.getLike()).thenReturn(Optional.of(new ShowLikeSegment(0,
0, "foo_order_federate")));
+ return Arrays.asList(
+ Arguments.of("show tables", new
MySQLShowTablesStatement(databaseType, null, null, false), 1),
+ Arguments.of("show full tables", new
MySQLShowTablesStatement(databaseType, null, null, true), 2),
+ Arguments.of("show full tables with lowercase like filter",
new MySQLShowTablesStatement(databaseType, null, filter, true), 2));
+ }
+
@Test
void assertShowTableFromUncompletedDatabase() throws SQLException {
MySQLShowTablesStatement sqlStatement = new
MySQLShowTablesStatement(databaseType, new FromDatabaseSegment(0, new
DatabaseSegment(0, 0, new IdentifierValue("uncompleted"))), null, false);