Skip to content

test: unpin the Ollama abort regression from port 11434 and make it actually exercise the abort#956

Open
gorkem2020 wants to merge 2 commits into
CortexReach:masterfrom
gorkem2020:fix/ollama-test-port-collision
Open

test: unpin the Ollama abort regression from port 11434 and make it actually exercise the abort#956
gorkem2020 wants to merge 2 commits into
CortexReach:masterfrom
gorkem2020:fix/ollama-test-port-collision

Conversation

@gorkem2020

Copy link
Copy Markdown
Contributor

Two defects in the Ollama abort regression (Test 8 of the CJK suite), found while running the full chain on a host with a real Ollama install:

  1. The mock bound 127.0.0.1:11434 to satisfy the provider detector, which EADDRINUSEs on any machine running a real Ollama and kills the whole npm test chain at position 3. The mock now listens on an ephemeral port and satisfies the detector through the /ollama path alternative of its regex instead.

  2. A pre-existing false pass: the mock served /v1/embeddings, but the Ollama-native route strips the /v1 suffix and posts to /api/embeddings, so the request 404ed instantly (about 3ms) and the elapsed assertion, which only had an upper bound, passed without the abort path ever running, on any machine including CI. The mock now serves the real path and the test requires the request to hang until the external AbortSignal fires (verified about 2000ms).

With this change the full test chain runs green end to end on hosts with and without a local Ollama.

The mock bound 127.0.0.1:11434 to satisfy isOllamaProvider(), which
EADDRINUSEs on any host running a real Ollama and killed the whole test
chain at position 3. Use an ephemeral port with an /ollama path baseURL
(the detection regex's third alternative) instead.

Also fixes a pre-existing false pass: the mock served /v1/embeddings but
the Ollama-native route posts to /api/embeddings (v1 stripped), so the
request 404ed instantly and the abort path was never exercised anywhere
- the elapsed assertion had no lower bound, so a 3ms failure passed. The
mock now serves the real path and the test requires the request to hang
until the abort fires.

(cherry picked from commit 742c6a3)
@gorkem2020
gorkem2020 marked this pull request as ready for review July 20, 2026 09:32
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