fix(docker): close read txn before second begin in disk-usage test
test_disk_usage_persisted opened a second session.begin() after interleaved
SELECTs, which autobegin a transaction → "A transaction is already begun".
Roll back the read transaction before the re-report write. Restores the
integration lane green for the /system/df slice (a840d6f).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Jg27rgypiW2efULXJDtMC
This commit is contained in:
@@ -267,6 +267,8 @@ def test_disk_usage_persisted(app):
|
|||||||
"FROM docker_disk_usage WHERE host_id=:h"), {"h": hid})).first()
|
"FROM docker_disk_usage WHERE host_id=:h"), {"h": hid})).first()
|
||||||
img_count = (await s.execute(text(
|
img_count = (await s.execute(text(
|
||||||
"SELECT COUNT(*) FROM docker_images WHERE host_id=:h"), {"h": hid})).scalar()
|
"SELECT COUNT(*) FROM docker_images WHERE host_id=:h"), {"h": hid})).scalar()
|
||||||
|
# End the autobegun read transaction before opening the next write one.
|
||||||
|
await s.rollback()
|
||||||
# Re-report with one image dropped — the stale row must be pruned.
|
# Re-report with one image dropped — the stale row must be pruned.
|
||||||
async with s.begin():
|
async with s.begin():
|
||||||
await persist(s, await s.get(Host, hid), [], None, disk2)
|
await persist(s, await s.get(Host, hid), [], None, disk2)
|
||||||
|
|||||||
Reference in New Issue
Block a user