Wire datetime_columns through query params and reads; add db_size and vacuum guard
This commit is contained in:
@@ -288,3 +288,21 @@ def test_vacuum_in_memory_is_noop(cache, source_conn):
|
||||
cache.load_table("users", ["name"], source_conn)
|
||||
cache.vacuum(incremental=False) # no-op, no error
|
||||
assert cache.is_table_cached("users") is True
|
||||
|
||||
|
||||
def test_incremental_vacuum_warns_without_incremental_auto_vacuum(tmp_path, source_conn):
|
||||
"""Incremental vacuum on a DB that isn't auto_vacuum=INCREMENTAL warns and skips."""
|
||||
from loguru import logger
|
||||
|
||||
messages: list[str] = []
|
||||
sink_id = logger.add(messages.append, level="WARNING", filter="sqlmem")
|
||||
logger.enable("sqlmem")
|
||||
try:
|
||||
c = CacheManager(db_path=tmp_path / "c.db", backup_interval=9999, in_memory=False)
|
||||
c.load_table("users", ["name"], source_conn)
|
||||
c.vacuum(incremental=True) # auto_vacuum defaults to NONE → no-op + warning
|
||||
c.close()
|
||||
finally:
|
||||
logger.remove(sink_id)
|
||||
logger.disable("sqlmem")
|
||||
assert any("auto_vacuum" in m for m in messages)
|
||||
|
||||
Reference in New Issue
Block a user