Skip to content

test: add regression test for Ollama configured model binding (#1735) - #1828

Merged
igordayen merged 3 commits into
embabel:mainfrom
sumin220:fix/1735-ollama-configured-model
Jul 27, 2026
Merged

test: add regression test for Ollama configured model binding (#1735)#1828
igordayen merged 3 commits into
embabel:mainfrom
sumin220:fix/1735-ollama-configured-model

Conversation

@sumin220

@sumin220 sumin220 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Adds the regression test for #1735 promised after #1818 merged.

The test registers a single discovered Ollama model (gemma3:latest) through OllamaModelsConfig, then builds per-request options through the same SpringAiLlmService.convertOptions path that ChatClientLlmOperations uses, and asserts the resulting OllamaChatOptions target the registered model rather than the mistral fallback that OllamaChatOptions substitutes for a null model.

Why a separate test

The converter tests added in #1818 verify field mapping (thinking options etc.) through the deprecated 1-arg convertOptions() and note explicitly that model stamping is not tested there. This test covers exactly that gap, end to end from model discovery/registration to the options that would go to the wire.

Verified against the pre-#1818 behavior: with the old code path the assertion fails with expected: <gemma3:latest> but was: <mistral>; on current main it passes. Ollama autoconfigure module suite passes (28/28).

Refs #1735 (closed by #1818 — this adds the regression coverage promised there)

…l#1735)

Verifies that a registered Ollama LLM sends requests targeting the model
it was registered for, rather than the OllamaChatOptions mistral fallback,
by exercising the same SpringAiLlmService.convertOptions path that
ChatClientLlmOperations uses to build per-request options.

Complements the converter field-mapping tests added in embabel#1818, which
deliberately leave model stamping uncovered.

Signed-off-by: sumin220 <173463176+sumin220@users.noreply.github.com>

@igordayen igordayen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sumin220 - could you please review comment, thank you

Addresses review feedback on embabel#1828: use Spring's ClassUtils.forName with
the config class's own loader instead of Class.forName, avoiding classpath
issues in environments with non-default loader hierarchies.

Signed-off-by: sumin220 <173463176+sumin220@users.noreply.github.com>

@igordayen igordayen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, minor comments to consider. thanks

Addresses review feedback on embabel#1828: both casts now fail with a clear
assertion message instead of a raw ClassCastException, and the bean
lookup reports the registered bean names when the expected bean is
missing (covering the null-from-map case as well).

Signed-off-by: sumin220 <173463176+sumin220@users.noreply.github.com>

@igordayen igordayen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good, please mark all inquiries as "Resolved", thank you

@sumin220

Copy link
Copy Markdown
Contributor Author

Done, all three resolved. Thanks for the careful review!

@igordayen igordayen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lloks good.

@igordayen
igordayen merged commit 83d6e1f into embabel:main Jul 27, 2026
1 check passed
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.

2 participants