fix(backend): swap db name in URL-style test DSN
deploy / deploy (push) Failing after 54s

The integration suite creates a per-run database and rewrites the admin
DSN to point at it via replaceDSNDatabase. The URL-style branch was a
stub that returned the DSN unchanged, so with a URL DSN every test ran
against the shared `postgres` database instead of its own — no isolation.
The first test to create a given user/object won; the rest collided on
unique constraints, surfacing as cascades of 500s (and ImportFromFolder
seeing accumulated rows).

CI passes TANABATA_TEST_ADMIN_DSN in URL form, so this only broke in the
deploy pipeline, not local key=value runs. Parse the URL and swap its
path to the per-run database.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 18:13:40 +03:00
parent a0a987d561
commit 6d13fa425a
+7 -1
View File
@@ -1614,7 +1614,13 @@ func replaceDSNDatabase(dsn, newDB string) string {
} }
return dsn + " dbname=" + newDB return dsn + " dbname=" + newDB
} }
// URL style: not used in our defaults, but handled for completeness. // URL style (e.g. postgres://user:pass@host:port/dbname?opts): the database
// is the URL path. CI passes this form via TANABATA_TEST_ADMIN_DSN, so it
// must swap the path to point the suite at its per-run database.
if u, err := url.Parse(dsn); err == nil {
u.Path = "/" + newDB
return u.String()
}
return dsn return dsn
} }