Ma77Ball commented on code in PR #8457:
URL: https://github.com/apache/texera/pull/8457#discussion_r4107561173


##########
common/dao/src/test/scala/org/apache/texera/dao/MockTexeraDB.scala:
##########
@@ -114,24 +131,15 @@ trait MockTexeraDB extends TestSuiteMixin { this: 
TestSuite =>
     synchronized {
       if (dataSource.isEmpty || dataSource.get.isClosed) {
         MockTexeraDB.ensureInitialized()
-        val embedded = MockTexeraDB.getDBInstance
 
-        uniqueDbName = "texera_db_" + 
java.util.UUID.randomUUID().toString.replace("-", "")
-        Using.resource(embedded.getPostgresDatabase.getConnection) { 
defaultConn =>
-          Using.resource(defaultConn.createStatement()) { stmt =>
-            stmt.execute(s"CREATE DATABASE $uniqueDbName")
-          }
-        }
-
-        // Run the DDL once via a throwaway connection (autoCommit is TRUE by 
default,
-        // so the schema is permanently committed to this suite's isolated 
database).
-        Using.resource(embedded.getDatabase("postgres", 
uniqueDbName).getConnection) { conn =>
-          Using.resource(conn.createStatement()) { stmt =>
-            stmt.execute(MockTexeraDB.getDDLScript)
-          }
-        }
+        uniqueDbName =
+          "texera_db_" + java.util.UUID.randomUUID().toString.replace("-", "")
+
+        MockTexeraDB.createTestDatabase(uniqueDbName)
 
+        val embedded = MockTexeraDB.getDBInstance
         val jdbcUrl = embedded.getJdbcUrl("postgres", uniqueDbName)
+

Review Comment:
   The extraction left a stray blank line between `val jdbcUrl` and `val ds`.
   
   Why it matters: the two lines are one logical step (build the URL, then the 
datasource), and the original code had no blank between them; the gap is just 
refactor residue.
   
   Suggested fix:
   
   ```suggestion
           val jdbcUrl = embedded.getJdbcUrl("postgres", uniqueDbName)
   ```



-- 
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]

Reply via email to