CI: test against a Postgres service (embedded Postgres won't run as root)
CI / test (push) Successful in 1m5s

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-10-29 03:48:32 -07:00
1 parent b9dc3f0ec1
commit 7afada1c63
3 files changed
+19 -10

No files matched your search

+8 -1
View File
@@ -33,6 +33,11 @@ import (
var dbURL string
func TestMain(m *testing.M) {
// CI gives a Postgres of its own (embedded Postgres won't run as root, as CI jobs do).
if url := os.Getenv("T5DE_TEST_DB"); url != "" {
dbURL = url
os.Exit(m.Run())
}
dir, _ := os.MkdirTemp("", "t5de-hub-test")
cache := os.Getenv("T5DE_PG_CACHE")
if cache == "" {
@@ -104,7 +109,9 @@ func newHub(t *testing.T) *hub {
t.Fatal(err)
}
admin.Close(ctx)
st, err := store.Open(ctx, strings.Replace(dbURL, "/postgres?", "/"+db+"?", 1))
u, _ := url.Parse(dbURL)
u.Path = "/" + db
st, err := store.Open(ctx, u.String())
if err != nil {
t.Fatal(err)
}