test: prefer in-memory databases in sqlite tests#64701
Conversation
Several SQLite tests created temporary file databases through a `nextDb()` helper even though they only exercise SQL behavior and never rely on filesystem persistence. Switch those to `:memory:`, which is faster and drops the temporary-file bookkeeping. Tests that verify on-disk behavior, such as the timeout and database-sync suites, keep using files. Refs: nodejs#64665 Signed-off-by: Paul Bouchon <mail@bitpshr.net>
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #64701 +/- ##
==========================================
- Coverage 90.14% 90.14% -0.01%
==========================================
Files 741 743 +2
Lines 242194 242324 +130
Branches 45606 45637 +31
==========================================
+ Hits 218323 218437 +114
- Misses 15358 15394 +36
+ Partials 8513 8493 -20 🚀 New features to boost your workflow:
|
araujogui
left a comment
There was a problem hiding this comment.
I believe we can extend the pattern to more test files
|
The only tests that need temporary files are DatabaseSync() constructor, open(), and backup(). |
Extend the change to the named-parameter and statement suites, which only exercise SQL behavior, and to the throwaway databases in the main test file. Tests that depend on an on-disk or shared database keep using files: the constructor, open() and backup() cases, the timeout and cross-worker suites, and the WAL journal-mode PRAGMA. Refs: nodejs#64665 Signed-off-by: Paul Bouchon <mail@bitpshr.net>
|
Done, extended it per your guidance. Converted the named-parameter and statement suites plus the throwaway databases in the main test file to I kept files in a few places beyond the constructor/open/backup cases where an on-disk or shared database is actually required: the timeout suite and the cross-worker changeset test (both share a database by path), and the |
Refs #64665. Converts the SQLite tests that only exercise SQL behavior (transactions, data types, typed-array/data-view binding) from temporary file databases to
:memory:, which is faster and drops thenextDb()temp-file bookkeeping.Tests that verify on-disk behavior (timeout, database-sync) intentionally keep using files. This is a focused first pass; the mixed-usage files (named-parameters, statement-sync) could follow.
Refs: #64665
cc @araujogui, let me know if this is what you had in mind, happy to extend it to the remaining files.