Add a real-DB migration test (the suite monkeypatches crud, so migrations are unexercised) #14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The unit suite deliberately isolates the functions under test by monkeypatching
crud/create_invoiceand driving async withasyncio.run— fast, no DB. The gap: migrations never actually run in tests. This let an install-breaking bug ship tomainundetected —CREATE INDEX ... ON chatelet.<table>is invalid SQLite grammar (fixed in #13, caught only by a manual real-DB smoke before tagging v0.1.0).What
Add a migration test that runs the real migration chain against a real (temp) SQLite via the lnbits
Databaseabstraction, then round-trips throughcrudto assert the schema:m001+m002(and any futurem00N) viachatelet.db.connect().Room(exercises thecheckin_instructionscolumn from m002) + aBooking(exercisesbig_intamount columns + indexes) viacrud, read back, assert.is_availableoverlap behaviour against real rows (not monkeypatched).A working reference already exists — the manual smoke script used during #13 (
migrations m001+m002 applied → room+booking round-trip). It needs adapting into a pytest fixture: setLNBITS_DATA_FOLDERto a temp dir and ensurechatelet.dbresolves there. The main unknown is how the lnbits extension test harness wants the ext DB configured — mirror whatever an existing extension (e.g.restaurant, which has schema-qualified indexes) does for DB-touching tests, or a self-contained temp-folder fixture.Acceptance
tests/test_migrations.pyapplies the full migration chain on a real SQLite temp DB and round-trips a room + booking throughcrud.make testwithout a live LNbits server.Low urgency (v0.1.0 migrations are now verified by hand), but this closes the class of bug that #13 was.
padreug referenced this issue2026-07-19 22:11:42 +00:00
padreug referenced this issue2026-07-19 22:17:31 +00:00