mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
Use Travis provided DB in migration test
This commit is contained in:
@@ -4,3 +4,8 @@ script:
|
|||||||
- sbt test
|
- sbt test
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk8
|
||||||
|
before_script:
|
||||||
|
- psql -c "CREATE ROLE sa WITH SUPERUSER LOGIN PASSWORD 'sa';" -U postgres
|
||||||
|
- psql -c "CREATE DATABASE gitbucket;" -U postgres
|
||||||
|
- mysql -e 'GRANT ALL ON *.* TO sa@"localhost"IDENTIFIED BY "sa";FLUSH PRIVILEGES;' -uroot
|
||||||
|
- mysql -e "CREATE DATABASE gitbucket;" -usa -psa
|
||||||
|
|||||||
@@ -27,50 +27,50 @@ class GitBucketCoreModuleSpec extends FunSuite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("Migration MySQL"){
|
test("Migration MySQL"){
|
||||||
val config = aMysqldConfig(v5_7_10)
|
// val config = aMysqldConfig(v5_7_10)
|
||||||
.withPort(3306)
|
// .withPort(3306)
|
||||||
.withUser("gitbucket", "gitbucket")
|
// .withUser("gitbucket", "gitbucket")
|
||||||
.withCharset(Charset.UTF8)
|
// .withCharset(Charset.UTF8)
|
||||||
.build()
|
// .build()
|
||||||
|
//
|
||||||
val mysqld = anEmbeddedMysql(config)
|
// val mysqld = anEmbeddedMysql(config)
|
||||||
.addSchema("gitbucket")
|
// .addSchema("gitbucket")
|
||||||
.start()
|
// .start()
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
new Solidbase().migrate(
|
new Solidbase().migrate(
|
||||||
DriverManager.getConnection("jdbc:mysql://localhost:3306/gitbucket", "gitbucket", "gitbucket"),
|
DriverManager.getConnection("jdbc:mysql://localhost:3306/gitbucket", "sa", "sa"),
|
||||||
Thread.currentThread().getContextClassLoader(),
|
Thread.currentThread().getContextClassLoader(),
|
||||||
new MySQLDatabase(),
|
new MySQLDatabase(),
|
||||||
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
|
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
|
||||||
)
|
)
|
||||||
} finally {
|
// } finally {
|
||||||
mysqld.stop()
|
// mysqld.stop()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
test("Migration PostgreSQL"){
|
test("Migration PostgreSQL"){
|
||||||
val runtime = PostgresStarter.getDefaultInstance()
|
// val runtime = PostgresStarter.getDefaultInstance()
|
||||||
val config = new PostgresConfig(
|
// val config = new PostgresConfig(
|
||||||
PRODUCTION,
|
// PRODUCTION,
|
||||||
new Net("localhost", 5432),
|
// new Net("localhost", 5432),
|
||||||
new Storage("gitbucket"),
|
// new Storage("gitbucket"),
|
||||||
new Timeout(),
|
// new Timeout(),
|
||||||
new Credentials("root", "root"))
|
// new Credentials("root", "root"))
|
||||||
|
//
|
||||||
val exec = runtime.prepare(config)
|
// val exec = runtime.prepare(config)
|
||||||
val process = exec.start()
|
// val process = exec.start()
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
new Solidbase().migrate(
|
new Solidbase().migrate(
|
||||||
DriverManager.getConnection("jdbc:postgresql://localhost:5432/gitbucket", "root", "root"),
|
DriverManager.getConnection("jdbc:postgresql://localhost:5432/gitbucket", "sa", "sa"),
|
||||||
Thread.currentThread().getContextClassLoader(),
|
Thread.currentThread().getContextClassLoader(),
|
||||||
new PostgresDatabase(),
|
new PostgresDatabase(),
|
||||||
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
|
new Module(GitBucketCoreModule.getModuleId, GitBucketCoreModule.getVersions)
|
||||||
)
|
)
|
||||||
} finally {
|
// } finally {
|
||||||
process.stop()
|
// process.stop()
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user