Every package's tests open a shared in-memory SQLite database: NewTestDatabase in internal/db/export_test.go, and the test setup in internal/handlers/api_test.go, internal/ircserver/server_test.go, internal/server/server_test.go and internal/service/service_test.go (file:NAME?mode=memory&cache=shared). The server's pool has one connection. A query cancelled while it runs makes the driver report that connection broken, and the pool closes it. A shared in-memory database lasts only while a connection to it is open, so all its tables and rows are gone. That is what made TestIntegrationKill fail at random (#205), and the worker on it saw hundreds of no such table errors from other tests' cleanup. Any test whose query is cancelled, by a client going away or by the server stopping, can fail the same way at random and turn next red.
Fix: a test's database keeps its tables and rows when the pool closes and replaces its connection. Keep each test's database its own, and keep every package under the 20-second test target in REPO_POLICIES.md; a temporary file database was measured slower for internal/handlers (#204), so weigh that.
Definition of done
After a query cancelled while it runs, a test database still has its tables and rows.
A test in internal/db for item 1 that fails against the current helpers.
Every package's test time stays under 20 seconds.
One reviewed PR against next.
Model: opus-5-5
Every package's tests open a shared in-memory SQLite database: `NewTestDatabase` in `internal/db/export_test.go`, and the test setup in `internal/handlers/api_test.go`, `internal/ircserver/server_test.go`, `internal/server/server_test.go` and `internal/service/service_test.go` (`file:NAME?mode=memory&cache=shared`). The server's pool has one connection. A query cancelled while it runs makes the driver report that connection broken, and the pool closes it. A shared in-memory database lasts only while a connection to it is open, so all its tables and rows are gone. That is what made `TestIntegrationKill` fail at random (https://git.eeqj.de/sneak/neoirc/issues/205), and the worker on it saw hundreds of `no such table` errors from other tests' cleanup. Any test whose query is cancelled, by a client going away or by the server stopping, can fail the same way at random and turn `next` red.
Fix: a test's database keeps its tables and rows when the pool closes and replaces its connection. Keep each test's database its own, and keep every package under the 20-second test target in `REPO_POLICIES.md`; a temporary file database was measured slower for `internal/handlers` (https://git.eeqj.de/sneak/neoirc/pulls/204), so weigh that.
## Definition of done
1. After a query cancelled while it runs, a test database still has its tables and rows.
2. A test in `internal/db` for item 1 that fails against the current helpers.
3. Every package's test time stays under 20 seconds.
4. One reviewed PR against `next`.
Model: opus-5-5
Built in #210: a test helper in internal/db holds one connection to each test database open until the test ends, so the database keeps its tables and rows when the pool replaces its connection. All five packages take their test database URL from it.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/neoirc/pulls/210: a test helper in `internal/db` holds one connection to each test database open until the test ends, so the database keeps its tables and rows when the pool replaces its connection. All five packages take their test database URL from it.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Every package's tests open a shared in-memory SQLite database:
NewTestDatabaseininternal/db/export_test.go, and the test setup ininternal/handlers/api_test.go,internal/ircserver/server_test.go,internal/server/server_test.goandinternal/service/service_test.go(file:NAME?mode=memory&cache=shared). The server's pool has one connection. A query cancelled while it runs makes the driver report that connection broken, and the pool closes it. A shared in-memory database lasts only while a connection to it is open, so all its tables and rows are gone. That is what madeTestIntegrationKillfail at random (#205), and the worker on it saw hundreds ofno such tableerrors from other tests' cleanup. Any test whose query is cancelled, by a client going away or by the server stopping, can fail the same way at random and turnnextred.Fix: a test's database keeps its tables and rows when the pool closes and replaces its connection. Keep each test's database its own, and keep every package under the 20-second test target in
REPO_POLICIES.md; a temporary file database was measured slower forinternal/handlers(#204), so weigh that.Definition of done
internal/dbfor item 1 that fails against the current helpers.next.Model: opus-5-5
Built in #210: a test helper in
internal/dbholds one connection to each test database open until the test ends, so the database keeps its tables and rows when the pool replaces its connection. All five packages take their test database URL from it.Model: opus-5-5