Skip to content

Instantly share code, notes, and snippets.

@takezoe
Last active May 25, 2016 17:36
Show Gist options
  • Save takezoe/e4d9ed92e0c0af52c2a709a5b291e6df to your computer and use it in GitHub Desktop.
Save takezoe/e4d9ed92e0c0af52c2a709a5b291e6df to your computer and use it in GitHub Desktop.
Test for GitBucket Migration with MySQL
"com.wix" % "wix-embedded-mysql" % "1.0.3" % "test"
package gitbucket.core
import java.sql.DriverManager
import org.scalatest.FunSuite
import com.wix.mysql.EmbeddedMysql._
import com.wix.mysql.config.MysqldConfig._
import com.wix.mysql.distribution.Version._
import io.github.gitbucket.solidbase.Solidbase
import io.github.gitbucket.solidbase.model.Module
import liquibase.database.core.MySQLDatabase
class GitBucketCoreModuleSpec extends FunSuite {
test("Migration: MySQL"){
val config = aMysqldConfig(v5_7_10).withPort(3306).withUser("root", "").build()
val mysqld = anEmbeddedMysql(config)
.addSchema("gitbucket")
.start()
try {
new Solidbase().migrate(
DriverManager.getConnection("jdbc:mysql://localhost:3306/gitbucket", "root", ""),
Thread.currentThread.getContextClassLoader,
new MySQLDatabase(),
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
)
} finally {
mysqld.stop()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment