Skip to content

Commit f0f3501

Browse files
ThomasVitaletzolov
authored andcommitted
Ollama integration tests fix
* Disable tests by default * Improve Testcontainers configuration
1 parent f004ee7 commit f0f3501

File tree

2 files changed

+4
-4
lines changed
  • models/spring-ai-ollama/src/test/java/org/springframework/ai/ollama
  • spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/ollama

2 files changed

+4
-4
lines changed

models/spring-ai-ollama/src/test/java/org/springframework/ai/ollama/BaseOllamaIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class BaseOllamaIT {
1010
private static final Logger logger = LoggerFactory.getLogger(BaseOllamaIT.class);
1111

1212
// Toggle for running tests locally on native Ollama for a faster feedback loop.
13-
private static final boolean useTestcontainers = false;
13+
private static final boolean useTestcontainers = true;
1414

1515
public static final OllamaContainer ollamaContainer;
1616

@@ -30,13 +30,13 @@ public class BaseOllamaIT {
3030
* to the file ".testcontainers.properties" located in your home directory
3131
*/
3232
public static boolean isDisabled() {
33-
return false;
33+
return true;
3434
}
3535

3636
public static OllamaApi buildOllamaApiWithModel(String model) {
3737
var baseUrl = "http://localhost:11434";
3838
if (useTestcontainers) {
39-
baseUrl = "http://" + ollamaContainer.getHost() + ":" + ollamaContainer.getMappedPort(11434);
39+
baseUrl = ollamaContainer.getEndpoint();
4040
}
4141
var ollamaApi = new OllamaApi(baseUrl);
4242

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/ollama/BaseOllamaIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static boolean isDisabled() {
3737
public static String buildConnectionWithModel(String model) throws IOException, InterruptedException {
3838
var baseUrl = "http://localhost:11434";
3939
if (useTestcontainers) {
40-
baseUrl = "http://" + ollamaContainer.getHost() + ":" + ollamaContainer.getMappedPort(11434);
40+
baseUrl = ollamaContainer.getEndpoint();
4141

4242
logger.info("Start pulling the '{}' model. The operation can take several minutes...", model);
4343
ollamaContainer.execInContainer("ollama", "pull", model);

0 commit comments

Comments
 (0)