From 05ac616789dc81c6c8100aeb7020c5a6559701ae Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 23 Nov 2023 17:03:57 +0100 Subject: [PATCH] nodb --- bootstrap_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstrap_test.go b/bootstrap_test.go index 8d77f81..10baf83 100644 --- a/bootstrap_test.go +++ b/bootstrap_test.go @@ -2,6 +2,7 @@ package txdb_test import ( "database/sql" + "net/url" "testing" ) @@ -25,7 +26,12 @@ const ( // bootstrap bootstraps the database with the nfor tests. func bootstrap(t *testing.T, driver, dsn string) { - db, err := sql.Open(driver, dsn) + parsed, err := url.Parse(dsn) + if err != nil { + t.Fatalf("failed to parse dsn %q: %s", dsn, err) + } + parsed.Path = "" // Remove the database name from the DSN + db, err := sql.Open(driver, parsed.String()) if err != nil { t.Fatal(err) }