mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-25 15:05:23 +00:00
MySQL, Postgres integration tests in drone (#1638)
* MySQL, Postgres integration tests in drone * Fix .drone.yml * sign drone * resign drone
This commit is contained in:
parent
0308d44a16
commit
66c803fae2
@ -44,7 +44,7 @@ pipeline:
|
||||
TAGS: bindata
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- echo make test-mysql # Not ready yet
|
||||
- make test-mysql
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
@ -55,7 +55,7 @@ pipeline:
|
||||
TAGS: bindata
|
||||
GOPATH: /srv/app
|
||||
commands:
|
||||
- echo make test-pqsql # Not ready yet
|
||||
- make test-pgsql
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
|
@ -1 +1 @@
|
||||
eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIGJhc2U6IC9zcnYvYXBwCiAgcGF0aDogc3JjL2NvZGUuZ2l0ZWEuaW8vZ2l0ZWEKCnBpcGVsaW5lOgogIGNsb25lOgogICAgaW1hZ2U6IHBsdWdpbnMvZ2l0CiAgICBkZXB0aDogNTAKICAgIHRhZ3M6IHRydWUKCiAgdGVzdDoKICAgIGltYWdlOiB3ZWJoaXBwaWUvZ29sYW5nOmVkZ2UKICAgIHB1bGw6IHRydWUKICAgIGVudmlyb25tZW50OgogICAgICBUQUdTOiBiaW5kYXRhIHNxbGl0ZQogICAgICBHT1BBVEg6IC9zcnYvYXBwCiAgICBjb21tYW5kczoKICAgICAgLSBhcGsgLVUgYWRkIG9wZW5zc2gtY2xpZW50CiAgICAgIC0gbWFrZSBjbGVhbgogICAgICAtIG1ha2UgZ2VuZXJhdGUKICAgICAgLSBtYWtlIHZldAogICAgICAtIG1ha2UgbGludAogICAgICAtIG1ha2UgdGVzdC12ZW5kb3IKICAgICAgLSBtYWtlIHRlc3QKICAgICAgLSBtYWtlIGJ1aWxkCiAgICB3aGVuOgogICAgICBldmVudDogWyBwd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ovw
|
1
Makefile
1
Makefile
@ -90,7 +90,6 @@ test-sqlite: integrations.test
|
||||
|
||||
.PHONY: test-mysql
|
||||
test-mysql: integrations.test
|
||||
echo "CREATE DATABASE IF NOT EXISTS testgitea" | mysql -u root
|
||||
GITEA_CONF=integrations/mysql.ini ./integrations.test
|
||||
|
||||
.PHONY: test-pgsql
|
||||
|
@ -6,8 +6,10 @@ package integrations
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
@ -26,13 +28,7 @@ import (
|
||||
var mac *macaron.Macaron
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
appIniPath := os.Getenv("GITEA_CONF")
|
||||
if appIniPath == "" {
|
||||
fmt.Println("Environment variable $GITEA_CONF not set")
|
||||
os.Exit(1)
|
||||
}
|
||||
setting.CustomConf = appIniPath
|
||||
routers.GlobalInit()
|
||||
initIntegrationTest()
|
||||
mac = routes.NewMacaron()
|
||||
routes.RegisterRoutes(mac)
|
||||
|
||||
@ -59,6 +55,48 @@ func TestMain(m *testing.M) {
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func initIntegrationTest() {
|
||||
if setting.CustomConf = os.Getenv("GITEA_CONF"); setting.CustomConf == "" {
|
||||
fmt.Println("Environment variable $GITEA_CONF not set")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
setting.NewContext()
|
||||
models.LoadConfigs()
|
||||
|
||||
switch {
|
||||
case setting.UseMySQL:
|
||||
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/",
|
||||
models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host))
|
||||
defer db.Close()
|
||||
if err != nil {
|
||||
log.Fatalf("sql.Open: %v", err)
|
||||
}
|
||||
if _, err = db.Exec("CREATE DATABASE IF NOT EXISTS testgitea"); err != nil {
|
||||
log.Fatalf("db.Exec: %v", err)
|
||||
}
|
||||
case setting.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))
|
||||
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))
|
||||
if err != nil {
|
||||
log.Fatalf("db.Query: %v", err)
|
||||
}
|
||||
if rows.Next() {
|
||||
break // database already exists
|
||||
}
|
||||
if _, err = db.Exec("CREATE DATABASE testgitea"); err != nil {
|
||||
log.Fatalf("db.Exec: %v", err)
|
||||
}
|
||||
}
|
||||
routers.GlobalInit()
|
||||
}
|
||||
|
||||
func prepareTestEnv(t *testing.T) {
|
||||
assert.NoError(t, models.LoadFixtures())
|
||||
assert.NoError(t, os.RemoveAll("integrations/gitea-integration"))
|
||||
|
@ -42,14 +42,14 @@ ENABLE_FEDERATED_AVATAR = false
|
||||
PROVIDER = file
|
||||
|
||||
[log]
|
||||
MODE = console,file
|
||||
MODE = console,file
|
||||
ROOT_PATH = mysql-log
|
||||
|
||||
[log.console]
|
||||
LEVEL = Warn
|
||||
|
||||
[log.file]
|
||||
LEVEL = Info
|
||||
ROOT_PATH = log
|
||||
LEVEL = Info
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
|
@ -43,13 +43,13 @@ PROVIDER = file
|
||||
|
||||
[log]
|
||||
MODE = console,file
|
||||
ROOT_PATH = pgsql-log
|
||||
|
||||
[log.console]
|
||||
LEVEL = Warn
|
||||
|
||||
[log.file]
|
||||
LEVEL = Info
|
||||
ROOT_PATH = log
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
func TestIncreaseDownloadCount(t *testing.T) {
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
|
||||
attachment, err := GetAttachmentByUUID("1234567890")
|
||||
attachment, err := GetAttachmentByUUID("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, int64(0), attachment.DownloadCount)
|
||||
|
||||
@ -21,7 +21,7 @@ func TestIncreaseDownloadCount(t *testing.T) {
|
||||
err = attachment.IncreaseDownloadCount()
|
||||
assert.NoError(t, err)
|
||||
|
||||
attachment, err = GetAttachmentByUUID("1234567890")
|
||||
attachment, err = GetAttachmentByUUID("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, int64(1), attachment.DownloadCount)
|
||||
}
|
||||
@ -53,7 +53,7 @@ func TestDeleteAttachments(t *testing.T) {
|
||||
err = DeleteAttachment(&Attachment{ID: 8}, false)
|
||||
assert.NoError(t, err)
|
||||
|
||||
attachment, err := GetAttachmentByUUID("test-12345")
|
||||
attachment, err := GetAttachmentByUUID("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18")
|
||||
assert.Error(t, err)
|
||||
assert.True(t, IsErrAttachmentNotExist(err))
|
||||
assert.Nil(t, attachment)
|
||||
|
@ -1,6 +1,6 @@
|
||||
-
|
||||
id: 1
|
||||
uuid: 1234567890
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11
|
||||
issue_id: 1
|
||||
comment_id: 0
|
||||
name: attach1
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
-
|
||||
id: 2
|
||||
uuid: 1122334455
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12
|
||||
issue_id: 1
|
||||
comment_id: 0
|
||||
name: attach2
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
-
|
||||
id: 3
|
||||
uuid: comment-id-1
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a13
|
||||
issue_id: 2
|
||||
comment_id: 1
|
||||
name: attach1
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
-
|
||||
id: 4
|
||||
uuid: comment-id-2
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14
|
||||
issue_id: 3
|
||||
comment_id: 1
|
||||
name: attach2
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
-
|
||||
id: 5
|
||||
uuid: comment-id-3
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a15
|
||||
issue_id: 4
|
||||
comment_id: 0
|
||||
name: attach1
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
-
|
||||
id: 6
|
||||
uuid: comment-id-4
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a16
|
||||
issue_id: 5
|
||||
comment_id: 2
|
||||
name: attach1
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
-
|
||||
id: 7
|
||||
uuid: comment-id-5
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17
|
||||
issue_id: 5
|
||||
comment_id: 2
|
||||
name: attach1
|
||||
@ -63,7 +63,7 @@
|
||||
|
||||
-
|
||||
id: 8
|
||||
uuid: test-12345
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18
|
||||
issue_id: 6
|
||||
comment_id: 0
|
||||
name: attach1
|
||||
|
@ -16,7 +16,7 @@
|
||||
-
|
||||
id: 2
|
||||
type: 0 # gitea pull request
|
||||
status: 1 # checking
|
||||
status: 2 # mergable
|
||||
issue_id: 3
|
||||
index: 3
|
||||
head_repo_id: 1
|
||||
|
Loading…
Reference in New Issue
Block a user