diff options
author | kolaente <konrad@kola-entertainments.de> | 2018-12-12 02:01:41 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2018-12-12 09:01:41 +0800 |
commit | 6db7dbd333204bcff50716e4840deee28e09c2f9 (patch) | |
tree | b68ee709873a91738b586fa57b367b2b217b0a4a /integrations | |
parent | b1f3685015246d3458f6d8c1d892eab076b3ed4a (diff) | |
download | gitea-6db7dbd333204bcff50716e4840deee28e09c2f9.tar.gz gitea-6db7dbd333204bcff50716e4840deee28e09c2f9.zip |
Added test environment for mssql (#4282)
* Added test environment for m$sql
* Added template for test environment for m$sql
* Fix password
* Fix password (again)
* Fix password (again again)
* Fix db
* Ci trigger (Looking at you drone....)
* Ci trigger (Looking at you drone....)
* Ci trigger (Looking at you drone....)
* Ci trigger (Looking at you drone....)
* Create master database for mssql integration tests
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Create database only if master do not exist
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix mssql integration tests by using custom database "gitea"
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Moved defer
* bump xorm
* updated xorm
* Fixed build
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/integration_test.go | 13 | ||||
-rw-r--r-- | integrations/mssql.ini.tmpl | 72 |
2 files changed, 85 insertions, 0 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go index ed165f6534..25f6cff27c 100644 --- a/integrations/integration_test.go +++ b/integrations/integration_test.go @@ -47,6 +47,8 @@ func TestMain(m *testing.M) { helper = &testfixtures.PostgreSQL{} } else if setting.UseSQLite3 { helper = &testfixtures.SQLite{} + } else if setting.UseMSSQL { + helper = &testfixtures.SQLServer{} } else { fmt.Println("Unsupported RDBMS for integration tests") os.Exit(1) @@ -130,6 +132,17 @@ 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) + 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)) + if err != nil { + log.Fatalf("sql.Open: %v", err) + } + if _, err := db.Exec("If(db_id(N'gitea') IS NULL) BEGIN CREATE DATABASE gitea; END;"); err != nil { + log.Fatalf("db.Exec: %v", err) + } + defer db.Close() } routers.GlobalInit() } diff --git a/integrations/mssql.ini.tmpl b/integrations/mssql.ini.tmpl new file mode 100644 index 0000000000..08f7e9ca37 --- /dev/null +++ b/integrations/mssql.ini.tmpl @@ -0,0 +1,72 @@ +APP_NAME = Gitea: Git with a cup of tea +RUN_MODE = prod + +[database] +DB_TYPE = mssql +HOST = {{TEST_MSSQL_HOST}} +NAME = {{TEST_MSSQL_DBNAME}} +USER = {{TEST_MSSQL_USERNAME}} +PASSWD = {{TEST_MSSQL_PASSWORD}} +SSL_MODE = disable + +[indexer] +ISSUE_INDEXER_PATH = integrations/indexers-mssql/issues.bleve +REPO_INDEXER_ENABLED = true +REPO_INDEXER_PATH = integrations/indexers-mssql/repos.bleve + +[repository] +ROOT = integrations/gitea-integration-mssql/gitea-repositories + +[repository.local] +LOCAL_COPY_PATH = tmp/local-repo-mssql +LOCAL_WIKI_PATH = tmp/local-wiki-mssql + +[server] +SSH_DOMAIN = localhost +HTTP_PORT = 3003 +ROOT_URL = http://localhost:3003/ +DISABLE_SSH = false +SSH_LISTEN_HOST = localhost +SSH_PORT = 2201 +START_SSH_SERVER = true +LFS_START_SERVER = true +LFS_CONTENT_PATH = data/lfs-mssql +OFFLINE_MODE = false +LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w +APP_DATA_PATH = integrations/gitea-integration-mssql/data + +[mailer] +ENABLED = false + +[service] +REGISTER_EMAIL_CONFIRM = false +ENABLE_NOTIFY_MAIL = false +DISABLE_REGISTRATION = false +ENABLE_CAPTCHA = false +REQUIRE_SIGNIN_VIEW = false +DEFAULT_KEEP_EMAIL_PRIVATE = false +DEFAULT_ALLOW_CREATE_ORGANIZATION = true +NO_REPLY_ADDRESS = noreply.example.org + +[picture] +DISABLE_GRAVATAR = false +ENABLE_FEDERATED_AVATAR = false + +[session] +PROVIDER = file +PROVIDER_CONFIG = data/sessions-mssql + +[log] +MODE = console,file +ROOT_PATH = mssql-log + +[log.console] +LEVEL = Warn + +[log.file] +LEVEL = Debug + +[security] +INSTALL_LOCK = true +SECRET_KEY = 9pCviYTWSb +INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTU1NTE2MTh9.hhSVGOANkaKk3vfCd2jDOIww4pUk0xtg9JRde5UogyQ |