Files
Crussell/backend/handlers/webhooks/testmain_test.go
T
popertots 5ea89da2ad Make Square webhook dedup restart-safe via database
The in-memory dedup is now only a fast path; the square_webhook_events INSERT ... ON CONFLICT DO NOTHING is the source of truth, so replays across restarts and after FIFO eviction are skipped. A DB failure fails closed with 503 so Square retries. Empty event_ids are rejected with 400 (no dispatch, no dedup row). Ordering trade-off (insert-before-dispatch) documented for when handlers mutate state.
2026-08-22 00:34:49 +01:00

21 lines
372 B
Go

//go:build test
package webhooks
import (
"os"
"testing"
"crussell/db"
"crussell/testutils/testdb"
)
func TestMain(m *testing.M) {
pool := testdb.CreateTestDatabase("crussell_test_handlers_webhooks")
db.Conn = db.NewPoolProxy(pool)
testdb.SeedBaseline(pool)
code := m.Run()
testdb.DestroyTestDatabase(pool, "crussell_test_handlers_webhooks")
os.Exit(code)
}