- Tests hash passwords at bcrypt.MinCost, set through the PasswordCost field of db.Params. TestPasswordCost checks the cost with and without it. - Test IRC servers check the queue only on broker notification; one test keeps the 100 ms fallback poll. - The stop-timeout test shortens the timeout through a test-only setter. - service and handlers tests build config.Config directly instead of through config.New, so they run in parallel. config exports DefaultTrustedProxies and ParseTrustedProxies for the handlers test config. - Repeated race trials run as parallel subtests. - Fixed sleeps become waits on the broker. - A new test covers the relay's failed queue read, which only the 100 ms poll had reached. Model: opus-5-5
This commit is contained in:
1 parent
f42c6214a0
commit
6c555958d6
14 files changed
+493
-240
No files matched your search
@@ -8,10 +8,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"sneak.berlin/go/neoirc/internal/dbtest"
|
||||
)
|
||||
|
||||
// NewTestDatabase creates an in-memory database for testing.
|
||||
// NewTestDatabase creates an in-memory database for testing. It
|
||||
// hashes passwords at bcrypt.MinCost.
|
||||
func NewTestDatabase(tb testing.TB) (*Database, error) {
|
||||
tb.Helper()
|
||||
|
||||
@@ -23,8 +25,9 @@ func NewTestDatabase(tb testing.TB) (*Database, error) {
|
||||
}
|
||||
|
||||
database := &Database{ //nolint:exhaustruct // test helper, params not needed
|
||||
conn: conn,
|
||||
log: slog.Default(),
|
||||
conn: conn,
|
||||
log: slog.Default(),
|
||||
passwordCost: bcrypt.MinCost,
|
||||
}
|
||||
|
||||
err = database.runMigrations(context.Background())
|
||||
|
||||
Reference in new issue
Block a user