Skip to content

test: cover blob upload chunk boundaries - #758

Open
j45856021-dev wants to merge 1 commit into
ollama:mainfrom
j45856021-dev:test/blob-upload-chunk-boundaries
Open

j45856021-dev wants to merge 1 commit into
ollama:mainfrom
j45856021-dev:test/blob-upload-chunk-boundaries

Conversation

@j45856021-dev

Copy link
Copy Markdown

The existing direct create_blob tests use empty files, so they do not exercise binary content or reads beyond the first 32 KiB chunk.

Add a 20-case matrix for Client and AsyncClient, HTTP 200/201, and payload lengths 0, 1, 32768, 32769, and 65537 bytes. It checks the complete request body, exact digest URL, returned digest, and one upload request. This is test-only; production code and the create() API are unchanged.

Validation

python -m pytest tests/test_client.py::test_create_blob_content tests/test_type_serialization.py tests/test_utils.py tests/test_systemone.py ollama/_client.py ollama/_types.py -q

66 passed on Python 3.13/macOS. Configured Ruff lint and formatting passed. Local fault injection confirmed that emptying the body fails all 16 nonempty cases, while truncating it to the first 32768 bytes fails exactly the eight larger-payload cases; the empty, one-byte, and exact-boundary controls still pass.

The new tests use the existing HTTPX MockTransport pattern and the actual source checkout. The sandbox prevented the existing socket-based tests from binding localhost and the VCS build backend from accessing Git configuration, so the full suite and package build were not completed. No Ollama server/model execution is claimed.

Disclosure: investigation, tests, and PR text were prepared autonomously with AI; no human pre-review is claimed.

Verify binary content, digest paths, and returned digests for both clients
at and beyond the 32 KiB read boundary, with HTTP 200 and 201 responses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant