Four test files now carry near-identical copies of the same helper. Each one parses CHRONICLE_TEST_DB_DSN, creates a scratch schema, applies migrations and drops the schema on cleanup:
internal/plugins/sessions/dbtest_support_test.go (newScratchDB)
internal/plugins/entities/repository_integration_test.go (openTestDB)
internal/plugins/timeline/repository_test.go (openTestDB, which also applies the calendar plugin's migrations)
internal/app/armory_npcs_visibility_leak_test.go (openGalleryTestDB)
Each copy is about 45 lines. One helper would remove about 130 lines, and the next DB-backed test couldn't get the make test-int-local DSN wrong again. That mistake is what #686 fixed. A helper package that takes the migration directories as arguments, for example internal/database/dbtest, would do it.
Watch out for two things:
tools/check-plugin-isolation.sh allowlists the timeline files by path.
- The Fresh-DB CI job asserts these tests by name, so keep the test names.
Four test files now carry near-identical copies of the same helper. Each one parses
CHRONICLE_TEST_DB_DSN, creates a scratch schema, applies migrations and drops the schema on cleanup:internal/plugins/sessions/dbtest_support_test.go(newScratchDB)internal/plugins/entities/repository_integration_test.go(openTestDB)internal/plugins/timeline/repository_test.go(openTestDB, which also applies the calendar plugin's migrations)internal/app/armory_npcs_visibility_leak_test.go(openGalleryTestDB)Each copy is about 45 lines. One helper would remove about 130 lines, and the next DB-backed test couldn't get the
make test-int-localDSN wrong again. That mistake is what #686 fixed. A helper package that takes the migration directories as arguments, for exampleinternal/database/dbtest, would do it.Watch out for two things:
tools/check-plugin-isolation.shallowlists the timeline files by path.