surface total job board outages
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
"""Warm-pool gate — the reorder/floor decision that keeps the shelf stocked without over-fetching."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from app.engine import search
|
||||
from app.engine.search import pool_decision
|
||||
from app.db.repo import search_signature
|
||||
|
||||
@@ -66,3 +71,21 @@ def test_legacy_and_camel_case_work_mode_have_same_signature():
|
||||
common = {"title": "Data Analyst", "location": ["Bangalore · India"]}
|
||||
|
||||
assert search_signature({**common, "workMode": ["Hybrid"]}) == search_signature({**common, "work_mode": ["Hybrid"]})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sweep_marks_total_board_failure(monkeypatch):
|
||||
async def fail_board(*_args, **_kwargs):
|
||||
raise RuntimeError("provider blocked")
|
||||
|
||||
monkeypatch.setattr(search, "_fetch_board", fail_board)
|
||||
monkeypatch.setattr(search, "get_settings", lambda: SimpleNamespace(
|
||||
BOARDS_ENABLED="naukri,foundit",
|
||||
BOARD_TIMEOUT_S=1,
|
||||
))
|
||||
|
||||
result = await search.run_sweep({"title": "Data Analyst", "location": ["Bangalore · India"]})
|
||||
|
||||
assert result["all_boards_failed"] is True
|
||||
assert result["failed_boards"] == 2
|
||||
assert result["sources"] == {}
|
||||
|
||||
Reference in New Issue
Block a user