diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/flyway/test/src/BuildTest.scala | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/contrib/flyway/test/src/BuildTest.scala b/contrib/flyway/test/src/BuildTest.scala new file mode 100644 index 00000000..9f51f72c --- /dev/null +++ b/contrib/flyway/test/src/BuildTest.scala @@ -0,0 +1,53 @@ +package mill.contrib.flyway + +import mill._ +import mill.scalalib._ +import mill.util.{TestEvaluator, TestUtil} +import utest.{TestSuite, Tests, assert, _} + +object BuildTest extends TestSuite { + object Build extends TestUtil.BaseModule { + object build extends FlywayModule { + + def resources = T.sources(os.pwd / 'contrib / 'flyway / 'test / 'resources) + + def postgres = ivy"org.postgresql:postgresql:42.2.5" + + def flywayUrl = "jdbc:postgresql:test_db" + def flywayUser = "postgres" + def flywayDriverDeps = Agg(postgres) + } + } + + def tests = Tests { + 'clean - { + val eval = new TestEvaluator(Build) + val Right((_, count)) = eval(Build.build.flywayClean()) + assert(count > 0) + } + + 'migrate - { + val eval = new TestEvaluator(Build) + val Right((res, count)) = eval(Build.build.flywayMigrate()) + assert( + count > 0, + res == 1 + ) + } + + 'migrateAgain - { + val eval = new TestEvaluator(Build) + val Right((res, count)) = eval(Build.build.flywayMigrate()) + assert( + count > 0, + res == 0 + ) + } + + 'info - { + val eval = new TestEvaluator(Build) + val Right((_, count)) = eval(Build.build.flywayInfo()) + assert(count > 0) + } + } +}
\ No newline at end of file |