This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 1906d45854f6 CAMEL-24772: camel-jbang - OllamaDoctorSupportTest no
longer fails on hosts that run Ollama (#26559)
1906d45854f6 is described below
commit 1906d45854f6e36c73f49ec37f34002be3e7c522
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Sep 17 19:14:02 2026 +0200
CAMEL-24772: camel-jbang - OllamaDoctorSupportTest no longer fails on hosts
that run Ollama (#26559)
CAMEL-24772: camel-jbang - OllamaDoctorSupportTest asserts the discovery
semantics for an unreachable URL instead of failing on hosts that run Ollama
Signed-off-by: Claus Ibsen <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
---
.../jbang/core/common/OllamaDoctorSupportTest.java | 25 +++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/OllamaDoctorSupportTest.java
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/OllamaDoctorSupportTest.java
index 9ae9131d2f9c..5041d7e854f7 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/OllamaDoctorSupportTest.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/common/OllamaDoctorSupportTest.java
@@ -40,15 +40,30 @@ class OllamaDoctorSupportTest {
}
}
+ /**
+ * {@code detect} is a discovery: an explicit URL that does not answer is
not the end of it, the client goes on to
+ * the {@code camel infra run ollama} PID files and the default {@code
localhost:11434}, which is what a doctor
+ * probe is for. So the outcome for an unreachable URL depends on the
host: nothing found when the host has no
+ * Ollama, the host's own Ollama otherwise, and never the unreachable URL
itself. Asserting only "not running"
+ * failed on every machine with Ollama running (CAMEL-24772).
+ */
@Test
- void detectReturnsNotRunningWhenEndpointUnreachable() {
- LlmClient client =
LlmClient.create().withApiType(LlmClient.ApiType.ollama).withUrl("http://127.0.0.1:1");
+ void anUnreachableUrlFallsBackToDiscoveryOfTheHostsOwnOllama() {
+ LlmClient discovery =
LlmClient.create().withApiType(LlmClient.ApiType.ollama);
+ boolean hostHasOllama = discovery.detectEndpoint();
+ LlmClient client =
LlmClient.create().withApiType(LlmClient.ApiType.ollama).withUrl("http://127.0.0.1:1");
OllamaDoctorSupport.Status status = OllamaDoctorSupport.detect(client);
- assertThat(status.running()).isFalse();
- assertThat(status.baseUrl()).isNull();
- assertThat(status.models()).isEmpty();
+ if (hostHasOllama) {
+ assertThat(status.running()).isTrue();
+
assertThat(status.baseUrl()).isEqualTo(discovery.endpointUrl()).isNotEqualTo("http://127.0.0.1:1");
+ assertThat(status.models()).isNotNull();
+ } else {
+ assertThat(status.running()).isFalse();
+ assertThat(status.baseUrl()).isNull();
+ assertThat(status.models()).isEmpty();
+ }
}
@Test