aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-09-18 09:36:14 +0800
committerGitHub <noreply@github.com>2020-09-18 09:36:14 +0800
commit1fb5bbd0984553f514db77728e532840fc4b9a33 (patch)
tree5ca03df49b562b1ff852d61196439897b5d74b53
parent06480af4723d34ac744c5f4f52fd974c3d016e59 (diff)
downloadgitea-1fb5bbd0984553f514db77728e532840fc4b9a33.tar.gz
gitea-1fb5bbd0984553f514db77728e532840fc4b9a33.zip
Fix pgsql migration test (#12844)
Co-authored-by: Lauris BH <lauris@nix.lv>
-rw-r--r--integrations/migration-test/migration_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/integrations/migration-test/migration_test.go b/integrations/migration-test/migration_test.go
index 22d74054c4..19a132054f 100644
--- a/integrations/migration-test/migration_test.go
+++ b/integrations/migration-test/migration_test.go
@@ -153,6 +153,7 @@ func restoreOldDB(t *testing.T, version string) bool {
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", setting.Database.Name))
assert.NoError(t, err)
+ db.Close()
db, err = sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?multiStatements=true",
setting.Database.User, setting.Database.Passwd, setting.Database.Host, setting.Database.Name))
@@ -183,6 +184,8 @@ func restoreOldDB(t *testing.T, version string) bool {
if !assert.NoError(t, err) {
return false
}
+ defer db.Close()
+
schrows, err := db.Query(fmt.Sprintf("SELECT 1 FROM information_schema.schemata WHERE schema_name = '%s'", setting.Database.Schema))
if !assert.NoError(t, err) || !assert.NotEmpty(t, schrows) {
return false