mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
tests/data lacked twelve migrations, and every test app ran them before its test began: about four seconds an app, which put core and apis past go test's ten minutes on the runner, and past thirty once the timeout was raised. The fixture now holds them (go run ./tests/fixture writes it), and TestTheFixtureIsMigrated fails, naming the migration, while one is missing. On one host core went from 267 s to 26 s, apis from 432 s to 23 s, and the whole suite runs in 51 s. The delete tests gave a background goroutine 100 ms to remove a record's files, which a slow runner did not always meet. BaseApp counts those deletions and WaitFileDeletes waits for them: the tests wait on the count instead of the clock, and ResetBootstrapState waits too, so a Base that stops no longer drops a deletion in flight. TestSQLRun expected a CREATE TABLE to report one affected row. SQLite answers a statement that writes no rows with the connection's last count, and that row was the last migration's _migrations insert; the handler now reads 0, the number it changed. go test runs with its default timeout again, and crm_test.go is gofmt'd.
528 KiB
528 KiB