feat(pool): register personal worker node candidates
This commit is contained in:
parent
bb5a7a2f61
commit
f3ca8c5da2
3 changed files with 71 additions and 0 deletions
16
server-tools/persona-compute-pool/test_scheduler.py
Normal file
16
server-tools/persona-compute-pool/test_scheduler.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
import importlib.util, unittest
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
spec=importlib.util.spec_from_file_location("scheduler",ROOT/"server-tools/persona-compute-pool/scheduler.py")
|
||||
M=importlib.util.module_from_spec(spec); assert spec.loader; spec.loader.exec_module(M)
|
||||
|
||||
class SchedulerTests(unittest.TestCase):
|
||||
def test_audit_excludes_mother_node(self):
|
||||
value=M.audit(); self.assertEqual(value["outcome"],"PASS"); self.assertTrue(value["mother_node_excluded"])
|
||||
def test_pending_workers_do_not_fake_a_lease(self):
|
||||
value=M.select({"min_cpu_cores":1,"min_memory_mb":256}); self.assertEqual(value["outcome"],"NO_ELIGIBLE_WORKER")
|
||||
def test_active_worker_is_selected_by_capacity(self):
|
||||
pool=M.load_map(); pool["nodes"][2]["state"]="ACTIVE_WORKER"; value=M.select({"min_cpu_cores":2,"min_memory_mb":1000},pool); self.assertEqual(value["outcome"],"LEASE_REQUESTED"); self.assertEqual(value["node_id"],"XX-GZ-001")
|
||||
|
||||
if __name__=="__main__": unittest.main()
|
||||
Loading…
Reference in a new issue