[fix](ut) fixed test cases failure for showCreateFunction (#28593)

2 tests cases (ShowCreateFunctionTest and ShowFunctionTest) have function name clash;
because of which one of the test fails to complete setup() and eventually fail for not able to create funciton.

Changed the name of the test function in 1 of the file.
This commit is contained in:
Nitin-Kashyap
2024-01-17 21:07:25 +05:30
committed by yiguolei
parent 7d1b3d4704
commit 4608bcd7bf

View File

@ -34,28 +34,28 @@ public class ShowCreateFunctionTest extends TestWithFeService {
createDatabase(dbName);
useDatabase(dbName);
createFunction(
"CREATE ALIAS FUNCTION id_masking(bigint) WITH PARAMETER(id) AS CONCAT(LEFT(id,3),'****',RIGHT(id,4));");
"CREATE ALIAS FUNCTION id_masking_create(bigint) WITH PARAMETER(id) AS CONCAT(LEFT(id,3),'****',RIGHT(id,4));");
createFunction(
"CREATE GLOBAL ALIAS FUNCTION id_masking_global(bigint) WITH PARAMETER(id) AS CONCAT(LEFT(id,3),'****',RIGHT(id,4));");
"CREATE GLOBAL ALIAS FUNCTION id_masking_global_create(bigint) WITH PARAMETER(id) AS CONCAT(LEFT(id,3),'****',RIGHT(id,4));");
}
@Test
public void testNormal() throws Exception {
String sql = "SHOW CREATE FUNCTION id_masking(bigint)";
String sql = "SHOW CREATE FUNCTION id_masking_create(bigint)";
ShowResultSet showResultSet = showCreateFunction(sql);
String showSql = showResultSet.getResultRows().get(0).get(1);
Assertions.assertTrue(showSql.contains("CREATE ALIAS FUNCTION id_masking(BIGINT) WITH PARAMETER(id)"));
Assertions.assertTrue(showSql.contains("CREATE ALIAS FUNCTION id_masking_create(BIGINT) WITH PARAMETER(id)"));
}
@Test
public void testShowCreateGlobalFunction() throws Exception {
String sql = "SHOW CREATE GLOBAL FUNCTION id_masking_global(bigint)";
String sql = "SHOW CREATE GLOBAL FUNCTION id_masking_global_create(bigint)";
ShowResultSet showResultSet = showCreateFunction(sql);
String showSql = showResultSet.getResultRows().get(0).get(1);
Assertions.assertTrue(
showSql.contains("CREATE GLOBAL ALIAS FUNCTION id_masking_global(BIGINT) WITH PARAMETER(id)"));
showSql.contains("CREATE GLOBAL ALIAS FUNCTION id_masking_global_create(BIGINT) WITH PARAMETER(id)"));
}
}