Neilk1021 commented on code in PR #6238:
URL: https://github.com/apache/texera/pull/6238#discussion_r3573648439
##########
amber/src/test/scala/org/apache/texera/amber/engine/e2e/TestUtils.scala:
##########
@@ -199,10 +198,28 @@ object TestUtils {
* Note such test cases need to clean up the database at the end of running
each test case.
*/
def initiateTexeraDBForTestCases(): Unit = {
+ org.apache.texera.dao.MockTexeraDB.ensureInitialized()
+ val embedded = org.apache.texera.dao.MockTexeraDB.getDBInstance
+
+ val dbName = "texera_db_for_test_cases_" +
java.util.UUID.randomUUID().toString.replace("-", "")
+
+ scala.util.Using.resource(embedded.getPostgresDatabase.getConnection) {
conn =>
+ scala.util.Using.resource(conn.createStatement()) { stmt =>
+ stmt.execute(s"DROP DATABASE IF EXISTS $dbName")
+ stmt.execute(s"CREATE DATABASE $dbName")
+ }
+ }
+
+ val targetDbConn = embedded.getDatabase("postgres", dbName).getConnection
Review Comment:
Fixed 2, 3, and 4. However, I think 1 would be more apt for a new git issue
rather than fixing directly here?
--
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]