fix: defer background cleanup until pending display is confirmed
This commit is contained in:
@@ -270,3 +270,24 @@ def test_automatic_wait_does_not_extend_past_sync_timeout(service):
|
||||
)
|
||||
service.process_one()
|
||||
assert service.operation(second)["status"] == "SYNCING"
|
||||
|
||||
|
||||
def test_automatic_cleanup_waits_for_display_confirmation(service, monkeypatch):
|
||||
first = submit(service)
|
||||
service.process_one()
|
||||
monkeypatch.setattr(service.cloud_library, "eligible", lambda *args: True)
|
||||
cleanup = service.submit(
|
||||
"delete",
|
||||
{"image_id": 1, "cloud_cleanup": True},
|
||||
"living-room",
|
||||
"cloud-library",
|
||||
"fixture-cleanup",
|
||||
)
|
||||
service.process_one()
|
||||
assert service.operation(cleanup)["status"] == "QUEUED"
|
||||
assert 1 in [x.image_id for x in service.registry.get("living-room").images()]
|
||||
service.sync()
|
||||
service.process_one()
|
||||
assert service.operation(first)["status"] == "COMPLETED"
|
||||
assert service.operation(cleanup)["status"] == "COMPLETED"
|
||||
assert 1 not in [x.image_id for x in service.registry.get("living-room").images()]
|
||||
|
||||
Reference in New Issue
Block a user