Skip external database test in Travis build

This commit is contained in:
Naoki Takezoe
2016-05-26 20:01:54 +09:00
parent c65e843491
commit f71acfcbe8
3 changed files with 45 additions and 39 deletions

View File

@@ -5,7 +5,7 @@ import java.sql.DriverManager
import io.github.gitbucket.solidbase.Solidbase
import io.github.gitbucket.solidbase.model.Module
import liquibase.database.core.{H2Database, MySQLDatabase, PostgresDatabase}
import org.scalatest.FunSuite
import org.scalatest.{FunSuite, Tag}
import com.wix.mysql.EmbeddedMysql._
import com.wix.mysql.config.Charset
import com.wix.mysql.config.MysqldConfig._
@@ -15,6 +15,8 @@ import ru.yandex.qatools.embed.postgresql.config.AbstractPostgresConfig.{Credent
import ru.yandex.qatools.embed.postgresql.config.PostgresConfig
import ru.yandex.qatools.embed.postgresql.distribution.Version.Main.PRODUCTION
object ExternalDBTest extends Tag("ExternalDBTest")
class GitBucketCoreModuleSpec extends FunSuite {
test("Migration H2"){
@@ -26,51 +28,51 @@ class GitBucketCoreModuleSpec extends FunSuite {
)
}
test("Migration MySQL"){
// val config = aMysqldConfig(v5_7_10)
// .withPort(3306)
// .withUser("gitbucket", "gitbucket")
// .withCharset(Charset.UTF8)
// .build()
//
// val mysqld = anEmbeddedMysql(config)
// .addSchema("gitbucket")
// .start()
//
// try {
test("Migration MySQL", ExternalDBTest){
val config = aMysqldConfig(v5_7_10)
.withPort(3306)
.withUser("sa", "sa")
.withCharset(Charset.UTF8)
.build()
val mysqld = anEmbeddedMysql(config)
.addSchema("gitbucket")
.start()
try {
new Solidbase().migrate(
DriverManager.getConnection("jdbc:mysql://localhost:3306/gitbucket", "sa", "sa"),
Thread.currentThread().getContextClassLoader(),
new MySQLDatabase(),
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
)
// } finally {
// mysqld.stop()
// }
} finally {
mysqld.stop()
}
}
test("Migration PostgreSQL"){
// val runtime = PostgresStarter.getDefaultInstance()
// val config = new PostgresConfig(
// PRODUCTION,
// new Net("localhost", 5432),
// new Storage("gitbucket"),
// new Timeout(),
// new Credentials("root", "root"))
//
// val exec = runtime.prepare(config)
// val process = exec.start()
//
// try {
test("Migration PostgreSQL", ExternalDBTest){
val runtime = PostgresStarter.getDefaultInstance()
val config = new PostgresConfig(
PRODUCTION,
new Net("localhost", 5432),
new Storage("gitbucket"),
new Timeout(),
new Credentials("sa", "sa"))
val exec = runtime.prepare(config)
val process = exec.start()
try {
new Solidbase().migrate(
DriverManager.getConnection("jdbc:postgresql://localhost:5432/gitbucket", "sa", "sa"),
Thread.currentThread().getContextClassLoader(),
new PostgresDatabase(),
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
)
// } finally {
// process.stop()
// }
} finally {
process.stop()
}
}
}