summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fischer <nfischer921@gmail.com>2019-04-09 17:53:06 -0700
committerTobias Roeser <le.petit.fou@web.de>2019-04-17 08:06:46 +0200
commitbb7673afc83bac32b756863c158d7fd4455d6fee (patch)
tree9f24fb518831b77318f7d7361a157b079f17369f
parent78c65edfcfdce450dad478c0d9ef91e524c31f7a (diff)
downloadmill-bb7673afc83bac32b756863c158d7fd4455d6fee.tar.gz
mill-bb7673afc83bac32b756863c158d7fd4455d6fee.tar.bz2
mill-bb7673afc83bac32b756863c158d7fd4455d6fee.zip
Tests
-rw-r--r--.travis.yml5
-rwxr-xr-xci/test-mill-0.5.sh11
-rw-r--r--contrib/flyway/test/src/BuildTest.scala53
-rw-r--r--docs/pages/9 - Contrib Modules.md1
4 files changed, 70 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
index e7a73872..9ae0ba67 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -28,6 +28,11 @@ matrix:
env: CI_SCRIPT=ci/test-mill-0.sh
jdk: oraclejdk8
- stage: build
+ env: CI_SCRIPT=ci/test-mill-0.5.sh
+ jdk: oraclejdk8
+ addons:
+ postgresql: "9.6"
+ - stage: build
env: CI_SCRIPT=ci/test-mill-1.sh
jdk: oraclejdk8
- stage: build
diff --git a/ci/test-mill-0.5.sh b/ci/test-mill-0.5.sh
new file mode 100755
index 00000000..20c58c7f
--- /dev/null
+++ b/ci/test-mill-0.5.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -eux
+
+# Starting from scratch...
+git clean -xdf
+
+psql -c 'create database test_db;' -U postgres
+
+# Run tests that use a db
+mill -i contrib.flyway.test
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
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md
index 7bf29dc2..2ce591d7 100644
--- a/docs/pages/9 - Contrib Modules.md
+++ b/docs/pages/9 - Contrib Modules.md
@@ -60,6 +60,7 @@ object foo extends JavaModule with FlywayModule {
```
Flyway will look for migration files in `db/migration` in all resources folders by default.
+This should work regardless of if you are using a mill or sbt project layout.
You can then run common flyway commands like
```