Move the test-only helpers out of the shipped db package (closes #248) #255

Merged
clawbot merged 1 commits from issue-248-test-helpers-out-of-db into next 2026-11-03 11:59:17 +01:00
1 Commits
Author SHA1 Message Date
sneak e44080fcbb Move the test-only helpers out of the shipped db package (closes #248)
check / check (push) Canceled after 0s
The server binary carried exported names that only tests call, including
raw SQL access and a way to weaken the password hash.

Delete testing.go, GetDB and SetBcryptCost from the shipped code, so
passwords always hash at bcrypt.DefaultCost. Move GetDB, GetOrCreateChannel,
JoinChannel and HasChannelInvite into export_test.go. Delete
GetClientHostInfo, whose remaining check GetLatestClientForSession covers.

Tests in other packages now build the database with db.New and run raw SQL
through dbtest.Exec. Handler tests and the relay tests' aliceWithHTTPClient
helper need a password only to log in, so they store one hashed at
bcrypt.MinCost. Tests of PASS itself keep the real cost.

Model: opus-5-5
2026-11-03 10:23:41 +00:00