diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-09-18 16:28:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-18 16:28:13 +0800 |
commit | 65ef634d5cd88b0a96ae82e5eee335ec10956f6f (patch) | |
tree | fc8829f38c4454c08b55faa6cc730eaf985fec16 | |
parent | 869fd17b88ecca1dcf4a0fa925156715aa29a312 (diff) | |
download | gitea-65ef634d5cd88b0a96ae82e5eee335ec10956f6f.tar.gz gitea-65ef634d5cd88b0a96ae82e5eee335ec10956f6f.zip |
Fix pgsql migration test (#12844) (#12884)
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
-rw-r--r-- | integrations/migration-test/migration_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/integrations/migration-test/migration_test.go b/integrations/migration-test/migration_test.go index 4ee045db38..081dd095fb 100644 --- a/integrations/migration-test/migration_test.go +++ b/integrations/migration-test/migration_test.go @@ -152,6 +152,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)) @@ -182,6 +183,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 |