diff --git a/tests/integration/test_astrolabe_session_jwt_search.py b/tests/integration/test_astrolabe_session_jwt_search.py index 6ad6bcf2..583a300a 100644 --- a/tests/integration/test_astrolabe_session_jwt_search.py +++ b/tests/integration/test_astrolabe_session_jwt_search.py @@ -44,17 +44,17 @@ _SEARCH_TIMEOUT = httpx.Timeout(90.0) async def _get_with_retry( - client: httpx.AsyncClient, url: str, *, retries: int = 2, **kwargs + client: httpx.AsyncClient, url: str, *, max_attempts: int = 3, **kwargs ) -> httpx.Response: - """GET with retries on transient transport errors (timeouts/conn resets).""" + """GET, retrying on transient transport errors (timeouts/conn resets).""" last_exc: httpx.TransportError | None = None - for attempt in range(retries + 1): + for attempt in range(1, max_attempts + 1): try: return await client.get(url, **kwargs) except httpx.TransportError as e: # covers timeouts + connect/read errors last_exc = e logger.warning( - "GET %s failed (attempt %s/%s): %s", url, attempt + 1, retries + 1, e + "GET %s failed (attempt %s/%s): %s", url, attempt, max_attempts, e ) await anyio.sleep(2) raise last_exc # type: ignore[misc] diff --git a/tests/integration/test_rag.py b/tests/integration/test_rag.py index a0c32834..41e8956c 100644 --- a/tests/integration/test_rag.py +++ b/tests/integration/test_rag.py @@ -174,16 +174,22 @@ async def indexed_manual_pdf(nc_client, nc_mcp_client): content = json.loads(result.content[0].text) if result.content else {} indexed = content.get("indexed_count", 0) pending = content.get("pending_count", 1) + status = content.get("status") logger.info( - "Attempt %s/%s: indexed=%s, pending=%s", + "Attempt %s/%s: indexed=%s, pending=%s, status=%s", attempt, max_attempts, indexed, pending, + status, ) - if indexed > 0 and pending == 0: + # Require indexed > 0 (the manual must actually be indexed — + # idle/pending==0 is also the *initial* empty state) AND a + # settled idle scan so we don't break during a transient + # pending==0 window mid re-scan churn. + if indexed > 0 and pending == 0 and status == "idle": logger.info( "Vector indexing complete: %s documents indexed", indexed )