summaryrefslogtreecommitdiffstats
path: root/integrations/integration_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-24 17:24:45 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-08-24 11:24:45 +0200
commitf83db078f0603c775cd1b1bb016f996b65a04835 (patch)
tree9895f852c768d43b384ba36259b44d9506b04093 /integrations/integration_test.go
parent26af3401c36e6316b81b92bf6a776bf2442d251c (diff)
downloadgitea-f83db078f0603c775cd1b1bb016f996b65a04835.tar.gz
gitea-f83db078f0603c775cd1b1bb016f996b65a04835.zip
Move database settings from models to setting (#7806)
* move database settings from models to setting * update docs * fix checkout pr * fix tests * fix lint * remove unsupported tidb options * correct wrong variable name * remove tidb totally
Diffstat (limited to 'integrations/integration_test.go')
-rw-r--r--integrations/integration_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go
index eaec2d509e..e4d506ee7d 100644
--- a/integrations/integration_test.go
+++ b/integrations/integration_test.go
@@ -59,13 +59,13 @@ func TestMain(m *testing.M) {
routes.RegisterRoutes(mac)
var helper testfixtures.Helper
- if setting.UseMySQL {
+ if setting.Database.UseMySQL {
helper = &testfixtures.MySQL{}
- } else if setting.UsePostgreSQL {
+ } else if setting.Database.UsePostgreSQL {
helper = &testfixtures.PostgreSQL{}
- } else if setting.UseSQLite3 {
+ } else if setting.Database.UseSQLite3 {
helper = &testfixtures.SQLite{}
- } else if setting.UseMSSQL {
+ } else if setting.Database.UseMSSQL {
helper = &testfixtures.SQLServer{}
} else {
fmt.Println("Unsupported RDBMS for integration tests")
@@ -121,12 +121,12 @@ func initIntegrationTest() {
setting.SetCustomPathAndConf("", "", "")
setting.NewContext()
setting.CheckLFSVersion()
- models.LoadConfigs()
+ setting.InitDBConfig()
switch {
- case setting.UseMySQL:
+ case setting.Database.UseMySQL:
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/",
- models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host))
+ setting.Database.User, setting.Database.Passwd, setting.Database.Host))
defer db.Close()
if err != nil {
log.Fatalf("sql.Open: %v", err)
@@ -134,14 +134,14 @@ func initIntegrationTest() {
if _, err = db.Exec("CREATE DATABASE IF NOT EXISTS testgitea"); err != nil {
log.Fatalf("db.Exec: %v", err)
}
- case setting.UsePostgreSQL:
+ case setting.Database.UsePostgreSQL:
db, err := sql.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/?sslmode=%s",
- models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host, models.DbCfg.SSLMode))
+ setting.Database.User, setting.Database.Passwd, setting.Database.Host, setting.Database.SSLMode))
defer db.Close()
if err != nil {
log.Fatalf("sql.Open: %v", err)
}
- rows, err := db.Query(fmt.Sprintf("SELECT 1 FROM pg_database WHERE datname = '%s'", models.DbCfg.Name))
+ rows, err := db.Query(fmt.Sprintf("SELECT 1 FROM pg_database WHERE datname = '%s'", setting.Database.Name))
if err != nil {
log.Fatalf("db.Query: %v", err)
}
@@ -153,10 +153,10 @@ func initIntegrationTest() {
if _, err = db.Exec("CREATE DATABASE testgitea"); err != nil {
log.Fatalf("db.Exec: %v", err)
}
- case setting.UseMSSQL:
- host, port := models.ParseMSSQLHostPort(models.DbCfg.Host)
+ case setting.Database.UseMSSQL:
+ host, port := setting.ParseMSSQLHostPort(setting.Database.Host)
db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;",
- host, port, "master", models.DbCfg.User, models.DbCfg.Passwd))
+ host, port, "master", setting.Database.User, setting.Database.Passwd))
if err != nil {
log.Fatalf("sql.Open: %v", err)
}