blob: d8c9d033196663a4106818c58b0fbc01018aaf6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
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"com.h2database:h2:1.4.199"
def flywayUrl = "jdbc:h2:mem:test_db;DB_CLOSE_DELAY=-1"
def flywayDriverDeps = Agg(postgres)
}
}
def tests = Tests {
test("clean"){
val eval = new TestEvaluator(Build)
val Right((_, count)) = eval(Build.build.flywayClean())
assert(count > 0)
}
test("migrate"){
val eval = new TestEvaluator(Build)
val Right((res, count)) = eval(Build.build.flywayMigrate())
assert(
count > 0,
res == 1
)
val Right((resAgain, countAgain)) = eval(Build.build.flywayMigrate())
assert(
countAgain > 0,
resAgain == 0
)
}
test("info"){
val eval = new TestEvaluator(Build)
val Right((_, count)) = eval(Build.build.flywayInfo())
assert(count > 0)
}
}
}
|