Skip to content

Commit 1da49fc

Browse files
committed
Add integration tests for Ollama
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent 7a02889 commit 1da49fc

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

.github/workflows/integration-tests.yml

+26-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ jobs:
5858
echo "Running container from image: $DOCKER_IMAGE"
5959
6060
# Run the container
61-
docker run --name $CONTAINER_NAME -d -p 8989:8989 -p 9090:9090 \
62-
-p 8990:8990 \
61+
docker run --name $CONTAINER_NAME -d --network host \
6362
-v "$(pwd)"/codegate_volume:/app/codegate_volume \
6463
-e CODEGATE_APP_LOG_LEVEL=DEBUG \
6564
--restart unless-stopped $DOCKER_IMAGE
@@ -146,6 +145,31 @@ jobs:
146145
run: |
147146
poetry run python tests/integration/integration_tests.py
148147
148+
- name: Run Ollama
149+
run: |
150+
docker run -d -v ollama:/root/.ollama --network host --name ollama ollama/ollama
151+
docker ps -f name=ollama
152+
echo "Loop until the endpoint responds successfully"
153+
while ! curl --silent --fail --get "http://localhost:11434" >/dev/null; do
154+
echo "Ollama not available yet. Retrying in 2 seconds..."
155+
sleep 2
156+
done
157+
echo "Ollama is now available!"
158+
docker exec -d ollama ollama run qwen2.5-coder:0.5b
159+
sleep 120 # Sleep for 2 minutes to allow Ollama to download the model. TODO: Improve this
160+
docker logs ollama
161+
162+
- name: Run integration tests - Ollama
163+
env:
164+
CODEGATE_PROVIDERS: "ollama"
165+
run: |
166+
poetry run python tests/integration/integration_tests.py
167+
168+
- name: Print the Ollama container logs (useful for debugging)
169+
if: always()
170+
run: |
171+
docker logs ollama
172+
149173
- name: Print the container logs (useful for debugging)
150174
if: always()
151175
run: |

tests/integration/testcases.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ headers:
44
openai:
55
Authorization: Bearer ENV_OPENAI_KEY
66
ollama:
7+
Content-Type: application/json
78
llamacpp:
89
anthropic:
910
x-api-key: ENV_ANTHROPIC_KEY
@@ -275,20 +276,20 @@ testcases:
275276
"role":"user"
276277
}
277278
],
278-
"model":"qwen2.5-coder:latest",
279+
"model":"qwen2.5-coder:0.5b",
279280
"stream":true,
280281
"temperature":0
281282
}
282283
likes: |
283-
Hello! How can I assist you today? If you have any questions or need guidance on secure coding practices, software security, package analysis, or anything else related to cybersecurity, feel free to ask!
284+
Hello! How can I assist you today?
284285
285286
ollama_fim:
286287
name: Ollama FIM
287288
provider: ollama
288289
url: http://127.0.0.1:8989/ollama/api/generate
289290
data: |
290291
{
291-
"model": "qwen2.5-coder:latest",
292+
"model": "qwen2.5-coder:0.5b",
292293
"max_tokens": 4096,
293294
"temperature": 0,
294295
"stream": true,

0 commit comments

Comments
 (0)