mirror of
https://github.com/hansjone/netx.git
synced 2026-10-16 03:00:46 +08:00
Fix ZTE BGP RR *i/RD parsing and add batch collect detail UX.
Decouple heavy CLI parse via ParsePool, keep ECMP/multi-RD keys, and expose per-command CLI lines vs DB rows with raw.txt export. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4c5738e48e
commit
05357e971e
31 changed files with 1952 additions and 269 deletions
|
|
@ -57,9 +57,8 @@ class BizStateCollectFinalizeTests(unittest.TestCase):
|
|||
def test_finalize_partial_after_heavy_timeout(self) -> None:
|
||||
with patch.object(runner, "SessionLocal", self.Session):
|
||||
with patch(
|
||||
"netx_api.biz_state.compare_service.try_auto_compare_for_task",
|
||||
return_value=None,
|
||||
):
|
||||
"netx_api.biz_state.compare_service.schedule_auto_compare_for_task",
|
||||
) as sched:
|
||||
status = runner._finalize_batch_status(
|
||||
batch_id="b-finalize",
|
||||
task_id="t-finalize",
|
||||
|
|
@ -70,6 +69,7 @@ class BizStateCollectFinalizeTests(unittest.TestCase):
|
|||
lane_errors=["RuntimeError: biz_state_heavy_timeout (2400s)"],
|
||||
)
|
||||
self.assertEqual(status, "partial")
|
||||
sched.assert_not_called()
|
||||
self.db.expire_all()
|
||||
batch = self.db.get(BizStateBatch, "b-finalize")
|
||||
assert batch is not None
|
||||
|
|
@ -127,8 +127,7 @@ class BizStateCollectFinalizeTests(unittest.TestCase):
|
|||
|
||||
with patch.object(runner, "SessionLocal", session_factory):
|
||||
with patch(
|
||||
"netx_api.biz_state.compare_service.try_auto_compare_for_task",
|
||||
return_value=None,
|
||||
"netx_api.biz_state.compare_service.schedule_auto_compare_for_task",
|
||||
):
|
||||
status = runner._finalize_batch_status(
|
||||
batch_id="b-finalize",
|
||||
|
|
@ -147,6 +146,23 @@ class BizStateCollectFinalizeTests(unittest.TestCase):
|
|||
self.assertEqual(batch.status, "partial")
|
||||
self.assertIn("biz_state_heavy_timeout", batch.message or "")
|
||||
|
||||
def test_finalize_success_schedules_auto_compare(self) -> None:
|
||||
with patch.object(runner, "SessionLocal", self.Session):
|
||||
with patch(
|
||||
"netx_api.biz_state.compare_service.schedule_auto_compare_for_task",
|
||||
) as sched:
|
||||
status = runner._finalize_batch_status(
|
||||
batch_id="b-finalize",
|
||||
task_id="t-finalize",
|
||||
cmd_count=55,
|
||||
total_rows=6606,
|
||||
any_fail=False,
|
||||
any_ok=True,
|
||||
lane_errors=[],
|
||||
)
|
||||
self.assertEqual(status, "success")
|
||||
sched.assert_called_once_with("t-finalize", "b-finalize")
|
||||
|
||||
def test_fail_batch_retries_on_stale_connection(self) -> None:
|
||||
calls = {"n": 0}
|
||||
real_session = self.Session
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue