Bind essentials recovery to explicit manifest and verified offsite provenance
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06ecb-456a-71c2-b41e-0755d336e883
This commit is contained in:
parent
4707bf08d7
commit
11322a5256
7 changed files with 151 additions and 14 deletions
|
|
@ -47,3 +47,29 @@ class BackupTiers(unittest.TestCase):
|
|||
c.get_object.return_value={'ContentLength':3,'Body':io.BytesIO(b'xyz')}
|
||||
with self.assertRaises(ValueError): primary.transfer(c,p,Path(d)/'out',{})
|
||||
c.delete_object.assert_not_called()
|
||||
|
||||
class EssentialsSealing(unittest.TestCase):
|
||||
def test_manifest_and_unique_data_survive_bulk_exclusion(self):
|
||||
from forgejo_essentials_profile import seal,MANIFEST
|
||||
import json
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
path=Path(d)/'archive.zip'
|
||||
with zipfile.ZipFile(path,'w') as z:
|
||||
for name in ['forgejo-db.sql','repos/a.git/HEAD','data/lfs/original','data/attachments/original','data/actions_artifacts/original','data/packages/bulk','data/actions_log/build']:
|
||||
z.writestr(name,b'fixture')
|
||||
seal(path)
|
||||
with zipfile.ZipFile(path) as z:
|
||||
self.assertEqual(z.read('data/lfs/original'),b'fixture')
|
||||
self.assertEqual(z.read('data/attachments/original'),b'fixture')
|
||||
self.assertEqual(z.read('data/actions_artifacts/original'),b'fixture')
|
||||
self.assertNotIn('data/packages/bulk',z.namelist())
|
||||
self.assertNotIn('data/actions_log/build',z.namelist())
|
||||
self.assertFalse(json.loads(z.read(MANIFEST))['package_registry_available'])
|
||||
def test_over_budget_preserves_original_candidate(self):
|
||||
import forgejo_essentials_profile as profile
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
path=Path(d)/'archive.zip'
|
||||
with zipfile.ZipFile(path,'w') as z: z.writestr('repos/a.git/HEAD',b'fixture')
|
||||
before=path.read_bytes()
|
||||
with patch.object(profile,'BUDGET',1), self.assertRaises(ValueError): profile.seal(path)
|
||||
self.assertEqual(path.read_bytes(),before)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue