diff options
Diffstat (limited to 'integrations/integration_test.go')
-rw-r--r-- | integrations/integration_test.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/integrations/integration_test.go b/integrations/integration_test.go index 6696ff65fc..4a809403bd 100644 --- a/integrations/integration_test.go +++ b/integrations/integration_test.go @@ -94,11 +94,12 @@ func initIntegrationTest() { 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) + defer rows.Close() + + if !rows.Next() { + if _, err = db.Exec("CREATE DATABASE testgitea"); err != nil { + log.Fatalf("db.Exec: %v", err) + } } } routers.GlobalInit() |