test: tolerate a 503 memory backend in the route-wiring tests (#685)

``TestMemoryRoutes.test_search`` and ``test_stats`` assert the status code
is in ``(200, 500)``. That list dates from the initial commit; #527 later
made the memory routes raise 503 when the native ``openjarvis_rust``
extension is missing, so both tests now fail on any checkout where the
extension has not been built — which is every contributor who has not run
``maturin develop``.

The failure is spurious: these two tests only check that the routes are
wired up, and their own comment ("May fail if SQLite not set up, that's
ok") says an unavailable backend is tolerated. 503 is exactly that case,
and it is already asserted deliberately in ``TestMemoryRustMissing``
directly below.

Add 503 to the tolerated set via a named constant, so the reason is stated
once rather than repeated as a bare literal.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Curryraj
2026-07-28 23:17:25 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent 81f1ffbb4f
commit 2bdd860b54
+8 -2
View File
@@ -37,16 +37,22 @@ class TestAgentRoutes:
class TestMemoryRoutes:
# 503 is the documented response when the native ``openjarvis_rust``
# extension is absent from the venv (see TestMemoryRustMissing below).
# These tests are only asserting "the route is wired up", so a backend
# that cannot be built is tolerated the same way a 500 is.
_BACKEND_OPTIONAL = (200, 500, 503)
def test_search(self):
client = TestClient(_make_app())
resp = client.post("/v1/memory/search", json={"query": "test"})
# May fail if SQLite not set up, that's ok
assert resp.status_code in (200, 500)
assert resp.status_code in self._BACKEND_OPTIONAL
def test_stats(self):
client = TestClient(_make_app())
resp = client.get("/v1/memory/stats")
assert resp.status_code in (200, 500)
assert resp.status_code in self._BACKEND_OPTIONAL
class TestMemoryRustMissing: