CAMEL-23205: Fix OpenAI embedding ITs to check exchange exceptions#22086
CAMEL-23205: Fix OpenAI embedding ITs to check exchange exceptions#22086
Conversation
|
Local test run (actual IT execution via Ran against local Ollama via testcontainers. |
apupier
left a comment
There was a problem hiding this comment.
this kind of change must be documented in the migration guide
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
Full reactor (72 modules)
|
|
Not sure I understand the issue with CAMEL-23205. If you want to run tests that include embeddings, then it should be mandatory to specify an embedding model, no? I don't get how changing the default encoding format fixes anything. |
|
@jamesnetherton The embedding model is specified — it comes from the Ollama test service via The issue is the
The producer code at The default was Changing the default to |
Take another look at https://issues.apache.org/jira/browse/CAMEL-23205. The problem was the that no embedding model was specified. The tests aren't checking whether the It's not related to encoding format. |
…d skip when no model - Add Assumptions.assumeTrue to skip tests when embedding model is unavailable - Add exception assertions after template.request() calls to catch errors before casting the body, preventing misleading ClassCastExceptions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@jamesnetherton You're absolutely right — I was wrong about the encoding format being the root cause. The The real issue was:
I've reworked the PR to:
Thanks for catching this! |
Not true. The Ollama test-infra provides this. The default is
Maybe not what we want. Not sure what other folks think, but it might be better to 'fail fast' in |
|
@jamesnetherton You're right that the container infra provides ...without specifying I agree that
Alternatively, we could also fix |
…available Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
The OpenAI embedding integration tests were failing with
ClassCastExceptionnot because of the encoding format default, but because:Missing embedding model: When
OllamaServiceConfiguration.embeddingModelName()returnsnull(no embedding model configured), the producer sets an exception on the exchange. The tests then tried to cast the unchanged body toList<Float>, causing aClassCastException.No exception checking: Tests called
template.request()but never checkedresult.getException()before casting the body.Changes
Assumptions.assumeTrue(ObjectHelper.isNotEmpty(embeddingModel))insetupResources()to skip tests when no embedding model is availableassertThat(result.getException()).isNull()after everytemplate.request()call to surface the real error instead of a misleadingClassCastExceptionTest plan