Refactor integration test targets in Makefile and update workflow

- Renamed integration test targets in the Makefile for clarity: `integration-tests` to `integration-tests-all` and added `integration-tests-basic`.
- Updated GitHub Actions workflow to run the new `integration-tests-basic` target.
- Cleaned up the `WithAuth` test class by removing unused imports and simplifying method signatures.
This commit is contained in:
amithkoujalgi 2025-09-29 10:36:13 +05:30
parent f114181fe2
commit 501c35fa44
No known key found for this signature in database
GPG Key ID: E29A37746AF94B70
3 changed files with 9 additions and 8 deletions

View File

@ -48,7 +48,7 @@ jobs:
run: mvn clean test -Punit-tests run: mvn clean test -Punit-tests
- name: Run integration tests - name: Run integration tests
run: mvn clean verify -Pintegration-tests run: mvn clean verify -Pintegration-tests-basic
env: env:
USE_EXTERNAL_OLLAMA_HOST: "true" USE_EXTERNAL_OLLAMA_HOST: "true"
OLLAMA_HOST: "http://localhost:11434" OLLAMA_HOST: "http://localhost:11434"

View File

@ -26,12 +26,16 @@ unit-tests: apply-formatting
@echo "\033[0;34mRunning unit tests...\033[0m" @echo "\033[0;34mRunning unit tests...\033[0m"
@mvn clean test -Punit-tests @mvn clean test -Punit-tests
integration-tests: apply-formatting integration-tests-all: apply-formatting
@echo "\033[0;34mRunning integration tests (local)...\033[0m" @echo "\033[0;34mRunning integration tests (local - all)...\033[0m"
@export USE_EXTERNAL_OLLAMA_HOST=false && mvn clean verify -Pintegration-tests @export USE_EXTERNAL_OLLAMA_HOST=false && mvn clean verify -Pintegration-tests
integration-tests-basic: apply-formatting
@echo "\033[0;34mRunning integration tests (local - basic)...\033[0m"
@export USE_EXTERNAL_OLLAMA_HOST=false && mvn clean verify -Pintegration-tests -Dit.test=WithAuth
integration-tests-remote: apply-formatting integration-tests-remote: apply-formatting
@echo "\033[0;34mRunning integration tests (remote)...\033[0m" @echo "\033[0;34mRunning integration tests (remote - all)...\033[0m"
@export USE_EXTERNAL_OLLAMA_HOST=true && export OLLAMA_HOST=http://192.168.29.229:11434 && mvn clean verify -Pintegration-tests -Dgpg.skip=true @export USE_EXTERNAL_OLLAMA_HOST=true && export OLLAMA_HOST=http://192.168.29.229:11434 && mvn clean verify -Pintegration-tests -Dgpg.skip=true
doxygen: doxygen:

View File

@ -22,7 +22,6 @@ import io.github.ollama4j.utils.OptionsBuilder;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.time.Duration; import java.time.Duration;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@ -174,14 +173,12 @@ public class WithAuth {
// (e.g., OllamaBaseException or IOException) // (e.g., OllamaBaseException or IOException)
// Optionally, you can assert the type/message of the exception if needed // Optionally, you can assert the type/message of the exception if needed
// For now, we treat any exception as a pass for this negative test // For now, we treat any exception as a pass for this negative test
return;
} }
} }
@Test @Test
@Order(2) @Order(2)
void testAskModelWithStructuredOutput() void testAskModelWithStructuredOutput() throws OllamaException, IOException {
throws OllamaException, IOException, InterruptedException, URISyntaxException {
api.setBearerAuth(BEARER_AUTH_TOKEN); api.setBearerAuth(BEARER_AUTH_TOKEN);
String model = GENERAL_PURPOSE_MODEL; String model = GENERAL_PURPOSE_MODEL;
api.pullModel(model); api.pullModel(model);