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:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user