From 6abf903f63b6cbf178b435b958822d88e26df5a7 Mon Sep 17 00:00:00 2001 From: Nathan Fischer Date: Wed, 10 Apr 2019 14:17:55 -0700 Subject: PR comments --- contrib/flyway/src/FlywayModule.scala | 2 +- .../resources/db/migration/V1__test_init_migration.sql | 5 +++++ contrib/flyway/test/src/BuildTest.scala | 15 +++++---------- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 contrib/flyway/test/resources/db/migration/V1__test_init_migration.sql (limited to 'contrib') diff --git a/contrib/flyway/src/FlywayModule.scala b/contrib/flyway/src/FlywayModule.scala index 75c66e97..f73e8e7b 100644 --- a/contrib/flyway/src/FlywayModule.scala +++ b/contrib/flyway/src/FlywayModule.scala @@ -41,7 +41,7 @@ trait FlywayModule extends JavaModule { .map(key -> _) private implicit val flywayWriter = writer[String].comap[Flyway](_.toString) - def flywayInstance = T.command { + def flywayInstance = T.worker { val jdbcClassloader = new URLClassLoader(jdbcClasspath().map(_.path.toIO.toURI.toURL).toArray) val configProps = Map(flyway.URL -> flywayUrl()) ++ diff --git a/contrib/flyway/test/resources/db/migration/V1__test_init_migration.sql b/contrib/flyway/test/resources/db/migration/V1__test_init_migration.sql new file mode 100644 index 00000000..964391a2 --- /dev/null +++ b/contrib/flyway/test/resources/db/migration/V1__test_init_migration.sql @@ -0,0 +1,5 @@ + +create table test_table ( + id bigserial primary key, + field varchar +); \ No newline at end of file diff --git a/contrib/flyway/test/src/BuildTest.scala b/contrib/flyway/test/src/BuildTest.scala index 9f51f72c..961e0522 100644 --- a/contrib/flyway/test/src/BuildTest.scala +++ b/contrib/flyway/test/src/BuildTest.scala @@ -11,10 +11,9 @@ object BuildTest extends TestSuite { def resources = T.sources(os.pwd / 'contrib / 'flyway / 'test / 'resources) - def postgres = ivy"org.postgresql:postgresql:42.2.5" + def postgres = ivy"com.h2database:h2:1.4.199" - def flywayUrl = "jdbc:postgresql:test_db" - def flywayUser = "postgres" + def flywayUrl = "jdbc:h2:mem:test_db;DB_CLOSE_DELAY=-1" def flywayDriverDeps = Agg(postgres) } } @@ -33,14 +32,10 @@ object BuildTest extends TestSuite { count > 0, res == 1 ) - } - - 'migrateAgain - { - val eval = new TestEvaluator(Build) - val Right((res, count)) = eval(Build.build.flywayMigrate()) + val Right((resAgain, countAgain)) = eval(Build.build.flywayMigrate()) assert( - count > 0, - res == 0 + countAgain > 0, + resAgain == 0 ) } -- cgit v1.2.3