feat(tests): auto-merge all model list responses and unify recordings (#3320)
Some checks failed
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 1s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Integration Tests (Replay) / Integration Tests (, , , client=, vision=) (push) Failing after 3s
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 4s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 7s
Update ReadTheDocs / update-readthedocs (push) Failing after 3s
Test External API and Providers / test-external (venv) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (push) Failing after 7s
Python Package Build Test / build (3.13) (push) Failing after 8s
Python Package Build Test / build (3.12) (push) Failing after 8s
Unit Tests / unit-tests (3.13) (push) Failing after 14s
Unit Tests / unit-tests (3.12) (push) Failing after 14s
UI Tests / ui-tests (22) (push) Successful in 1m7s
Pre-commit / pre-commit (push) Successful in 2m34s

One needed to specify record-replay related environment variables for
running integration tests. We could not use defaults because integration
tests could be run against Ollama instances which could be running
different models. For example, text vs vision tests needed separate
instances of Ollama because a single instance typically cannot serve
both of these models if you assume the standard CI worker configuration
on Github. As a result, `client.list()` as returned by the Ollama client
would be different between these runs and we'd end up overwriting
responses.

This PR "solves" it by adding a small amount of complexity -- we store
model list responses specially, keyed by the hashes of the models they
return. At replay time, we merge all of them and pretend that we have
the union of all models available.

## Test Plan

Re-recorded all the tests using `scripts/integration-tests.sh
--inference-mode record`, including the vision tests.
This commit is contained in:
Ashwin Bharambe 2025-09-03 11:33:03 -07:00 committed by GitHub
parent d948e63340
commit c3d3a0b833
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
122 changed files with 17460 additions and 16129 deletions

View file

@ -15,23 +15,23 @@
"body": {
"__type__": "openai.types.completion.Completion",
"__data__": {
"id": "cmpl-43",
"id": "cmpl-775",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"text": "Blue.\n\nMy response is based on the traditional English rhyme that pairs the colors of roses (red) with violets in a poetic and somewhat whimsical way. This specific version of the rhyme goes like this:\n\n\"Roses are red,\nViolets are blue,\nSugar is sweet,\nAnd so are you.\"\n\nIn modern times, variations of this rhyme can deviate from the original \"blue\" for violets, but in my complete sentence as requested, sticking with a widely recognized completion adds an air of timelessness and familiarity to the phrase."
"text": "Blue.\n\nMy response is based on the traditional rhyme \"Roses are Red, Violets are Blue,\" which is a well-known poem or phrase often used as a greeting or way to express affection. The exact wording may vary slightly depending on the source, but the general meaning remains the same: violets are typically depicted as blue-colored flowers in this rhyme."
}
],
"created": 1754348148,
"created": 1756921025,
"model": "llama3.2:3b-instruct-fp16",
"object": "text_completion",
"system_fingerprint": "fp_ollama",
"usage": {
"completion_tokens": 113,
"completion_tokens": 75,
"prompt_tokens": 50,
"total_tokens": 163,
"total_tokens": 125,
"completion_tokens_details": null,
"prompt_tokens_details": null
}