Skip to content

test: add API endpoint test suite and enable the CI test job#50

Merged
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:test/28-api-endpoint-tests
Jun 10, 2026
Merged

test: add API endpoint test suite and enable the CI test job#50
gordonmurray merged 1 commit into
lance-format:mainfrom
gordonmurray:test/28-api-endpoint-tests

Conversation

@gordonmurray

Copy link
Copy Markdown
Collaborator

Summary

The CI test job has been printing debug output since the endpoint tests were commented out. The blocker turned out to be a dependency clash: the job installs unpinned httpx, and httpx 0.28 removed the app= kwarg that the starlette version pinned by fastapi 0.104 still passes to TestClient. Pinning httpx<0.28 fixes that, so the job now runs a real pytest suite.

  • 30 tests in backend/tests/ using pytest and FastAPI TestClient: health and compat flags, dataset listing, schema and column metadata, pagination and column filtering, value serialization (nulls, binary, vectors, CLIP detection), vector preview stats, and the informational-row fallback for corrupted datasets.
  • The fixture builds sample tables in a tmpdir with whatever lancedb version is installed, so the same tests run for every constraints file. One quirk it handles: Lance format v1 (0.3.x/0.5) stores a null list as an empty list, so the affected tests check at runtime which behavior the installed version has.
  • One small backend fix to make the tests meaningful: /rows and /vector/preview re-raise HTTPException, so the 400 for unknown column names reaches the client instead of being turned into a generic 500 by the catch-all handler.

Test plan

  • Ran the suite in python:3.11-slim against all six constraints files (0.3.1, 0.3.4, 0.5, 0.16.0, 0.24.3, 0.29.2): 30 passed on each
  • CI test job goes green on this PR for the full matrix

Fixes #28

The CI test job only printed debug info because TestClient broke when
an unpinned httpx (0.28+) removed the app= kwarg that the starlette
version pinned by fastapi 0.104 still passes. Pinning httpx<0.28 fixes
that, so the job now runs a real pytest suite.

The suite covers all six endpoints: health and compat flags, dataset
listing, schema and column metadata, row pagination and column
filtering, value serialization (binary, nulls, vectors, CLIP
detection), vector preview stats, and the informational-row fallback
for corrupted datasets. Fixtures build sample tables in a tmpdir with
whatever lancedb version is installed, so the same tests run against
every constraints file. Lance format v1 stores a null list as an empty
list, so the affected tests detect at runtime which behavior the
installed version has.

Also re-raise HTTPException in /rows and /vector/preview so the 400s
for unknown columns reach the client instead of being masked as 500s.

Fixes lance-format#28
@gordonmurray gordonmurray merged commit 6d93b9c into lance-format:main Jun 10, 2026
12 checks passed
@gordonmurray gordonmurray deleted the test/28-api-endpoint-tests branch June 10, 2026 18:35
@gordonmurray gordonmurray mentioned this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add API endpoint tests

1 participant