remove sqlite tag when integration test with mysql/postgres AND recreate database when init integration test (#1693)
This commit is contained in:
parent
377acb9757
commit
d98a86d2a2
2 changed files with 12 additions and 5 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue