feat: "Fazer backup agora" in Integrações
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 4m40s
Build and deploy / Secret scan and release gate (push) Successful in 13s
Build and deploy / Publish images (push) Successful in 1m29s

The backup row gets a button that asks for a backup outside the daily hour,
for after a failure or before a risky change. The Kanban records the
request; the backup service, which alone may read the whole database, looks
every minute and runs it. The row says it was asked for until it runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-16 17:09:00 -03:00
parent bd718796c5
commit 6919383d37
6 changed files with 64 additions and 6 deletions

View File

@@ -31,6 +31,14 @@ def main():
os.environ['BACKUP_AGE_RECIPIENT'] = public
check(db_backup.configured(), 'the local backup service is configured once a recipient is set')
# "Fazer backup agora" in the Kanban is seen by the service.
before = datetime.now(timezone.utc)
with admin_connect() as c:
c.execute("INSERT INTO dtf_local.backup_requests(requested_by) VALUES('backup-test')")
check(db_backup.requested_since(before), 'a backup asked for in the Kanban is seen by the service')
with admin_connect() as c:
c.execute("DELETE FROM dtf_local.backup_requests WHERE requested_by='backup-test'")
live = db_backup.counts(None)
key = db_backup.run_once()
with admin_connect() as c:

View File

@@ -145,7 +145,17 @@ def run():
assert row['fetched_at'] is None and row['failed_at'] is not None
assert '11222333000181' not in registry.pending(c, 500)
Client().call('/operator/stats', expected=401)
print('PASS: artwork pictures (owner only, images only), quote filters, the order/quote search and the numbers')
# "Fazer backup agora": recorded for the backup service, shown as asked.
with db.connect() as c:
c.execute('DELETE FROM dtf_local.backup_requests')
Client().call('/operator/backup/run', {}, expected=401)
client.call('/operator/backup/run', {}, operator=True)
assert client.call('/operator/board', operator=True)['providers']['backup']['requested'] is True
with db.connect() as c:
c.execute('DELETE FROM dtf_local.backup_requests')
assert client.call('/operator/board', operator=True)['providers']['backup']['requested'] is False
print('PASS: artwork pictures (owner only, images only), quote filters, the order/quote search, the numbers '
'and a backup asked for now')
finally:
with db.connect() as c:
c.execute('DELETE FROM dtf_local.orders WHERE id=%s', (order_id,))