Freeze labelled B14 B15 budget continuations retaining completed10 and original costs
This commit is contained in:
1 parent
783608f73b
commit
7b470069f7
6 files changed
+218320
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import unittest,tempfile,json
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
import phase2_gate_continuation as m
|
||||
class ContinueTests(unittest.TestCase):
|
||||
def test_reject_replayed_completed_part(self):
|
||||
with patch.object(m,'config',return_value=dict(continuation_approval='1794904082.797009',new_indices=list(range(431)))):
|
||||
with self.assertRaises(PermissionError):m.validated(Path('/tmp'))
|
||||
def test_accept_only421_new(self):
|
||||
c=dict(continuation_approval='1794904082.797009',new_indices=list(range(10,431)))
|
||||
with patch.object(m,'config',return_value=c):self.assertIs(m.validated(Path('/tmp')),c)
|
||||
def test_guard_uses_immutable_worker_original_wall_cap(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
root=Path(d);g=root/'guards/field-0010';g.mkdir(parents=True)
|
||||
c=dict(worker_cpus=[0],scientific_entry='tools/phase2_b14_gate.py',part_wall_seconds=120,rss_bytes=8*2**30,disk_bytes=5*2**30)
|
||||
result=dict(status='PASS',cpu_seconds=.01)
|
||||
with patch.object(m,'validated',return_value=c),patch.object(m.os,'sched_setaffinity'),patch.object(m,'supervise',return_value=result) as call:
|
||||
self.assertEqual(m.guard(root,'field',10,0,60),0)
|
||||
args=call.call_args.args;self.assertEqual(args[0][1],'tools/phase2_b14_gate.py');self.assertEqual(args[2]['wall_seconds'],120)
|
||||
self.assertEqual(json.loads((g/'guard-result.json').read_text())['guard']['status'],'PASS')
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in new issue
Block a user