修复:独立回收中断备份并限制 AI 日志增长
This commit is contained in:
@@ -21,6 +21,16 @@ ops = importlib.util.module_from_spec(spec); spec.loader.exec_module(ops)
|
||||
|
||||
|
||||
class OperationsTests(unittest.TestCase):
|
||||
def test_native_logs_are_counted_once_and_do_not_hide_other_runtime_artifacts(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
root=Path(d).resolve();native=root/'.runtime/nao-users/actor'
|
||||
for relative in ['logs/server.log','private/nao.sqlite']:
|
||||
path=native/relative;path.parent.mkdir(parents=True,exist_ok=True);path.write_bytes(b'x'*8192)
|
||||
(root/'.runtime/tool.bin').write_bytes(b'x'*16384)
|
||||
sample=ops.snapshot(root,root/'support')
|
||||
self.assertEqual(sample['coreBytes'],sum(sample[k] for k in ['mysqlBytes','archiveBytes','backupBytes','logBytes','nativeDataBytes']))
|
||||
self.assertEqual(sample['artifactBytes'],ops.allocated(root/'.runtime')-ops.allocated(root/'.runtime/nao-users'))
|
||||
|
||||
def sample(self, **extra):
|
||||
return {'at': 200000., 'coreBytes': 12*ops.GIB, 'permanentBytes': 40*ops.GIB,
|
||||
'freeBytes': 500*ops.GIB, 'overdueTestResources': 0, **extra}
|
||||
|
||||
Reference in New Issue
Block a user