summaryrefslogtreecommitdiffstats
path: root/integrations/integration_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-05-09 21:42:55 +0800
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-05-09 15:42:55 +0200
commitd98a86d2a2f9c12955316aff5723e03f14c0fe5d (patch)
treec952e06e5644120827a50ced163eb6ee5f1a60c0 /integrations/integration_test.go
parent377acb975785140aba35ec19fdae467e0e8cc129 (diff)
downloadgitea-d98a86d2a2f9c12955316aff5723e03f14c0fe5d.tar.gz
gitea-d98a86d2a2f9c12955316aff5723e03f14c0fe5d.zip
remove sqlite tag when integration test with mysql/postgres AND recreate database when init integration test (#1693)
Diffstat (limited to 'integrations/integration_test.go')
-rw-r--r--integrations/integration_test.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go
index 4a809403bd..1bac2c1964 100644
--- a/integrations/integration_test.go
+++ b/integrations/integration_test.go
@@ -79,6 +79,9 @@ func initIntegrationTest() {
if err != nil {
log.Fatalf("sql.Open: %v", err)
}
+ if _, err = db.Exec("DROP DATABASE IF EXISTS testgitea"); err != nil {
+ log.Fatalf("db.drop db: %v", err)
+ }
if _, err = db.Exec("CREATE DATABASE IF NOT EXISTS testgitea"); err != nil {
log.Fatalf("db.Exec: %v", err)
}
@@ -96,11 +99,14 @@ func initIntegrationTest() {
}
defer rows.Close()
- if !rows.Next() {
- if _, err = db.Exec("CREATE DATABASE testgitea"); err != nil {
- log.Fatalf("db.Exec: %v", err)
+ if rows.Next() {
+ if _, err = db.Exec("DROP DATABASE testgitea"); err != nil {
+ log.Fatalf("db.drop db: %v", err)
}
}
+ if _, err = db.Exec("CREATE DATABASE testgitea"); err != nil {
+ log.Fatalf("db.Exec: %v", err)
+ }
}
routers.GlobalInit()
}