diff --git a/test/com/m3/octoparts/support/db/DBSuite.scala b/test/com/m3/octoparts/support/db/DBSuite.scala index fa73c86a..32f7d9e9 100644 --- a/test/com/m3/octoparts/support/db/DBSuite.scala +++ b/test/com/m3/octoparts/support/db/DBSuite.scala @@ -14,10 +14,13 @@ import org.scalatest.{ Status, Args, BeforeAndAfterAll, fixture } trait DBSuite extends AutoRollback2 with BeforeAndAfterAll with PlayAppSupport { this: fixture.Suite => override def beforeAll(): Unit = { - tearDown() migrate() } + override def afterAll(): Unit = { + tearDown() + } + /* * No-op abstract override to resolve multiple definitions of run in extended traits */ diff --git a/test/com/m3/octoparts/support/db/RequiresDB.scala b/test/com/m3/octoparts/support/db/RequiresDB.scala index 2aa6029b..8d9453a8 100644 --- a/test/com/m3/octoparts/support/db/RequiresDB.scala +++ b/test/com/m3/octoparts/support/db/RequiresDB.scala @@ -21,41 +21,41 @@ import scala.util.control.NonFatal */ private[support] trait RequiresDB extends Suite { - lazy val flyway = { + def flyway = { val flyway = new Flyway - flyway.setCallbacks(new FlywayCallback { - def beforeInit(conn: Connection) = conn.setReadOnly(false) - - def beforeRepair(conn: Connection) = conn.setReadOnly(false) - - def beforeValidate(conn: Connection) = conn.setReadOnly(false) - - def beforeInfo(conn: Connection) = conn.setReadOnly(false) - - def beforeClean(conn: Connection) = conn.setReadOnly(false) - - def beforeMigrate(conn: Connection) = conn.setReadOnly(false) - - def beforeBaseline(conn: Connection) = conn.setReadOnly(false) - - def beforeEachMigrate(conn: Connection, p2: MigrationInfo) = conn.setReadOnly(false) - - def afterInfo(conn: Connection) = conn.setReadOnly(false) - - def afterInit(conn: Connection) = conn.setReadOnly(false) - - def afterRepair(conn: Connection) = conn.setReadOnly(false) - - def afterValidate(conn: Connection) = conn.setReadOnly(false) - - def afterEachMigrate(conn: Connection, p2: MigrationInfo) = conn.setReadOnly(false) - - def afterMigrate(conn: Connection) = conn.setReadOnly(false) - - def afterClean(conn: Connection) = conn.setReadOnly(false) - - def afterBaseline(conn: Connection) = conn.setReadOnly(false) - }) + // flyway.setCallbacks(new FlywayCallback { + // def beforeInit(conn: Connection) = conn.setReadOnly(false) + // + // def beforeRepair(conn: Connection) = conn.setReadOnly(false) + // + // def beforeValidate(conn: Connection) = conn.setReadOnly(false) + // + // def beforeInfo(conn: Connection) = conn.setReadOnly(false) + // + // def beforeClean(conn: Connection) = conn.setReadOnly(false) + // + // def beforeMigrate(conn: Connection) = conn.setReadOnly(false) + // + // def beforeBaseline(conn: Connection) = conn.setReadOnly(false) + // + // def beforeEachMigrate(conn: Connection, p2: MigrationInfo) = conn.setReadOnly(false) + // + // def afterInfo(conn: Connection) = conn.setReadOnly(false) + // + // def afterInit(conn: Connection) = conn.setReadOnly(false) + // + // def afterRepair(conn: Connection) = conn.setReadOnly(false) + // + // def afterValidate(conn: Connection) = conn.setReadOnly(false) + // + // def afterEachMigrate(conn: Connection, p2: MigrationInfo) = conn.setReadOnly(false) + // + // def afterMigrate(conn: Connection) = conn.setReadOnly(false) + // + // def afterClean(conn: Connection) = conn.setReadOnly(false) + // + // def afterBaseline(conn: Connection) = conn.setReadOnly(false) + // }) flyway.setDataSource(ConnectionPool().dataSource) flyway.setPlaceholderPrefix("$flyway{") flyway @@ -70,12 +70,12 @@ private[support] trait RequiresDB extends Suite { def tearDown(): Unit = { try { /* - Tries to drop all objects in the database. + Tries to drop all objects in the database. - Needs to be in this try because it throws the database doesn't have the schema_version - table, which may happen if in an arbitrary test, someone decides to drop everything in the - database directly without initiating it again. - */ + Needs to be in this try because it throws the database doesn't have the schema_version + table, which may happen if in an arbitrary test, someone decides to drop everything in the + database directly without initiating it again. + */ flyway.clean() } catch { case NonFatal(e) => LTSVLogger.error(e)