Route the delivery tests' gorm.Open through gormlog (closes #462)
check / check (push) Successful in 3m11s

The six gorm.Open calls in the internal/delivery tests passed a bare
gorm.Config, which installs GORM's default logger; they now pass
gormlog.New over a logger that discards, as every production call does,
so the unfiltered form is no longer in the tree to be copied.

The README and the ParamsFilter comment said (*gorm.DB).Scan had one
test-only caller; there are more. Both now say only tests call it, with
fixture data.

Model: opus-5-5
This commit is contained in:
2026-10-02 17:22:31 +00:00
parent 73353bc8e5
commit f195dab8c4
6 changed files with 23 additions and 14 deletions
+3 -1
View File
@@ -25,6 +25,7 @@ import (
_ "modernc.org/sqlite"
"sneak.berlin/go/webhooker/internal/database"
"sneak.berlin/go/webhooker/internal/delivery"
"sneak.berlin/go/webhooker/internal/gormlog"
"sneak.berlin/go/webhooker/internal/metrics"
)
@@ -49,7 +50,8 @@ func testWebhookDB(t *testing.T) *gorm.DB {
t.Cleanup(func() { _ = sqlDB.Close() })
db, err := gorm.Open(
sqlite.Dialector{Conn: sqlDB}, &gorm.Config{},
sqlite.Dialector{Conn: sqlDB},
&gorm.Config{Logger: gormlog.New(slog.New(slog.DiscardHandler))},
)
require.NoError(t, err)