Estimate repair storage needs live without relying on journal history

This commit is contained in:
admin committed 2026-10-18 17:07:27 +02:00
1 parent d22838f818
commit 72969605fd
3 files changed
+78 -13

No files matched your search

+6
View File
@@ -10,6 +10,12 @@ m = importlib.util.module_from_spec(spec)
spec.loader.exec_module(m)
class PreservationTests(unittest.TestCase):
def test_live_budget_preserves_file_metadata_sql_and_growth_allowances(self):
raw=100 + 2*8192 + 200*3 + 67108864
self.assertEqual(m.snapshot_budget([(100,2)],[200]),raw*12//10+67108864)
with self.assertRaises(ValueError):m.snapshot_budget([(-1,2)],[])
with self.assertRaises(ValueError):m.snapshot_budget([],[-1])
def test_plan_keeps_root_reserve_and_stops_when_var_target_is_met(self):
self.assertEqual(m.choose_moves([('a', 48), ('b', 7), ('c', 7), ('d', 7)], 26, 77, 84, 12), [('a',48),('b',7),('c',7)])
with self.assertRaises(RuntimeError):