fix: one file the worker may not delete no longer stops the cleanup of every other file
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m23s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m34s
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m23s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m34s
CI run 318 failed in retention_test: an expired upload outside the storage policy's prefixes (originals/, videos/) made delete_object raise AccessDenied, and the cleanup stopped there on every tick, so no file behind it was ever deleted. The worker now logs it as an error (so it reaches Sentry), tries that file again a day later and goes on with the rest; retention_test covers it. The test fixtures that wrote keys under test/, machine-test/, machine-log-test/ and reset-test/ now use originals/, where the worker may delete them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,13 @@ def run():
|
||||
with connect() as c:
|
||||
c.execute('INSERT INTO dtf_local.uploads(id,owner,name,size,object_key,multipart_id,complete,expires_at) VALUES(%s,%s,%s,%s,%s,%s,true,%s)',
|
||||
(uid,uuid4(),'LOCAL-RETENTION-TEST.txt',len(b'LOCAL RETENTION TEST'),key,upload,expiry))
|
||||
# A file outside the storage policy's prefixes cannot be deleted: it must
|
||||
# not stop the cleanup of the others, and is tried again a day later.
|
||||
denied=uuid4()
|
||||
with connect() as c:
|
||||
c.execute('INSERT INTO dtf_local.uploads(id,owner,name,size,object_key,multipart_id,complete,expires_at,created_at) VALUES(%s,%s,%s,1,%s,%s,true,%s,%s)',
|
||||
(denied,uuid4(),'LOCAL-RETENTION-DENIED.txt',f'retention-denied/{denied}','',
|
||||
datetime.now(timezone.utc)-timedelta(days=1),datetime.now(timezone.utc)-timedelta(days=400)))
|
||||
# Cleanup takes 50 at a time, oldest first: the suites before this one
|
||||
# leave their own expired files ahead of the fixture.
|
||||
for _ in range(100):
|
||||
@@ -27,6 +34,10 @@ def run():
|
||||
with connect() as c:
|
||||
assert c.execute('SELECT purged_at FROM dtf_local.uploads WHERE id=%s',(ids[0],)).fetchone()['purged_at']
|
||||
assert not c.execute('SELECT purged_at FROM dtf_local.uploads WHERE id=%s',(ids[1],)).fetchone()['purged_at']
|
||||
with connect() as c:
|
||||
row=c.execute('SELECT purged_at,expires_at>now() AS later FROM dtf_local.uploads WHERE id=%s',(denied,)).fetchone()
|
||||
assert not row['purged_at'] and row['later'],row
|
||||
c.execute('DELETE FROM dtf_local.uploads WHERE id=%s',(denied,))
|
||||
try:storage.size(f'originals/{ids[0]}');raise AssertionError('Expired bytes still exist')
|
||||
except ClientError as exc:assert exc.response['ResponseMetadata']['HTTPStatusCode']==404
|
||||
assert storage.size(f'originals/{ids[1]}')==len(b'LOCAL RETENTION TEST')
|
||||
|
||||
Reference in New Issue
Block a user