test: add regression test for Ollama configured model binding (#1735) - #1828
Merged
igordayen merged 3 commits intoJul 27, 2026
Merged
Conversation
…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
reviewed
Jul 26, 2026
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
reviewed
Jul 27, 2026
igordayen
left a comment
Contributor
There was a problem hiding this comment.
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
reviewed
Jul 27, 2026
igordayen
left a comment
Contributor
There was a problem hiding this comment.
Looks very good, please mark all inquiries as "Resolved", thank you
Contributor
Author
|
Done, all three resolved. Thanks for the careful review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds the regression test for #1735 promised after #1818 merged.
The test registers a single discovered Ollama model (
gemma3:latest) throughOllamaModelsConfig, then builds per-request options through the sameSpringAiLlmService.convertOptionspath thatChatClientLlmOperationsuses, and asserts the resultingOllamaChatOptionstarget the registered model rather than themistralfallback thatOllamaChatOptionssubstitutes 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)