You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/07/18 19:00:42 UTC

(camel) branch main updated: CAMEL-23215: Prevent SpringAiImageOllamaIT from blocking on retries

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 01c474a8e346 CAMEL-23215: Prevent SpringAiImageOllamaIT from blocking on retries
01c474a8e346 is described below

commit 01c474a8e346671d54964245ed43cd0b1d847f08
Author: Omar Atie <at...@gmail.com>
AuthorDate: Sat Jul 18 12:00:35 2026 -0700

    CAMEL-23215: Prevent SpringAiImageOllamaIT from blocking on retries
    
    Disable Spring AI default exponential backoff retry template in the
    Ollama image IT so a failing call surfaces quickly instead of blocking
    CI for ~16 minutes. Adds a class-level @Timeout(180) safety net.
    
    Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
 .../component/springai/image/SpringAiImageOllamaIT.java      | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
index 046f074da3c7..ed5c1ff8df7a 100644
--- a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
+++ b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-image/src/test/java/org/apache/camel/component/springai/image/SpringAiImageOllamaIT.java
@@ -28,6 +28,7 @@ import org.apache.camel.test.infra.ollama.services.OllamaService;
 import org.apache.camel.test.infra.ollama.services.OllamaServiceFactory;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.api.io.TempDir;
@@ -38,9 +39,9 @@ import org.springframework.ai.image.ImageModel;
 import org.springframework.ai.openai.OpenAiImageModel;
 import org.springframework.ai.openai.OpenAiImageOptions;
 import org.springframework.ai.openai.api.OpenAiImageApi;
-import org.springframework.ai.retry.RetryUtils;
 import org.springframework.http.MediaType;
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.retry.support.RetryTemplate;
 import org.springframework.web.client.RestClient;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -55,6 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
  * converter that supports this media type.
  */
 @DisabledIfSystemProperty(named = "ci.env.name", matches = ".*", disabledReason = "Disabled unless running in CI")
+@Timeout(180)
 public class SpringAiImageOllamaIT extends CamelTestSupport {
 
     private static final Logger LOG = LoggerFactory.getLogger(SpringAiImageOllamaIT.class);
@@ -100,7 +102,13 @@ public class SpringAiImageOllamaIT extends CamelTestSupport {
                 .model(IMAGE_MODEL_NAME)
                 .build();
 
-        imageModel = new OpenAiImageModel(imageApi, defaultOptions, RetryUtils.DEFAULT_RETRY_TEMPLATE);
+        // Disable Spring AI default exponential backoff retries in ITs: a failing Ollama call would
+        // otherwise block CI for many minutes (see CAMEL-23215).
+        RetryTemplate noRetryTemplate = RetryTemplate.builder()
+                .maxAttempts(1)
+                .build();
+
+        imageModel = new OpenAiImageModel(imageApi, defaultOptions, noRetryTemplate);
         LOG.info("ImageModel initialized successfully");
     }