test(db): fail the lock-release test with what a stranded lock costs

setup_database logs and continues when assets are disabled, so a failed init
that keeps the lock blocks every other instance for its whole lifetime. The
assertion message says so; the acquire it replaces said nothing.
This commit is contained in:
Simon Pinfold
2026-08-26 20:10:05 -07:00
parent 1d5cc1e36e
commit 21382fbcad

View File

@@ -64,7 +64,14 @@ def test_failed_init_releases_the_lock(stale_db, monkeypatch):
db_module._init_file_db(db_module.args.database_url)
contender = FileLock(stale_db + ".lock")
contender.acquire(timeout=0)
try:
contender.acquire(timeout=0)
except Timeout:
pytest.fail(
"a failed init stranded the lock; setup_database logs and CONTINUES when assets are "
"disabled, so this process would block every other instance for its whole lifetime "
"over a database it never opened"
)
contender.release()