This is an automated email from the ASF dual-hosted git repository.
wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
The following commit(s) were added to refs/heads/main by this push:
new 462dbc44 [python] Remove Python-3.10-only Ollama auto-pull block in
integration tests (#831)
462dbc44 is described below
commit 462dbc44d753e426300fdcae8750de290bdc3345
Author: Weiqing Yang <[email protected]>
AuthorDate: Thu Jun 11 01:54:40 2026 -0700
[python] Remove Python-3.10-only Ollama auto-pull block in integration
tests (#831)
---
.../chat_models/tests/start_ollama_server.sh | 40 ----------------------
.../chat_models/tests/test_ollama_chat_model.py | 30 ++--------------
.../local/tests/start_ollama_server.sh | 39 ---------------------
.../local/tests/test_ollama_embedding_model.py | 26 ++------------
4 files changed, 5 insertions(+), 130 deletions(-)
diff --git
a/python/flink_agents/integrations/chat_models/tests/start_ollama_server.sh
b/python/flink_agents/integrations/chat_models/tests/start_ollama_server.sh
deleted file mode 100644
index bf7a50a0..00000000
--- a/python/flink_agents/integrations/chat_models/tests/start_ollama_server.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-################################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#################################################################################
-
-# only works on linux
-os=$(uname -s)
-echo $os
-if [[ $os == "Linux" ]]; then
- curl -fsSL https://ollama.com/install.sh | sh
- ret=$?
- if [ "$ret" != "0" ]
- then
- exit $ret
- fi
-
- if curl -f http://localhost:11434/api/tags >/dev/null 2>&1; then
- echo "Ollama is already running"
- else
- echo "Starting Ollama server"
- ollama serve &
- sleep 10 # wait for ollama to start
- fi
-
- echo "ollama pull $1"
- ollama pull $1
-fi
\ No newline at end of file
diff --git
a/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
b/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
index 27f07f34..1f3fd261 100644
---
a/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
+++
b/python/flink_agents/integrations/chat_models/tests/test_ollama_chat_model.py
@@ -16,17 +16,14 @@
# limitations under the License.
#################################################################################
import os
-import subprocess
-import sys
-from pathlib import Path
from unittest.mock import MagicMock
import pytest
-from ollama import Client
from flink_agents.api.chat_message import ChatMessage, MessageRole
from flink_agents.api.resource import Resource, ResourceType
from flink_agents.api.resource_context import ResourceContext
+from flink_agents.e2e_tests.test_utils import pull_model
from flink_agents.integrations.chat_models.ollama_chat_model import (
OllamaChatModelConnection,
OllamaChatModelSetup,
@@ -37,29 +34,8 @@ from flink_agents.plan.tools.function_tool import
FunctionTool
pytestmark = pytest.mark.integration
test_model = os.environ.get("OLLAMA_CHAT_MODEL", "qwen3:1.7b")
-current_dir = Path(__file__).parent
-
-try:
- # only auto setup ollama in ci with python 3.10 to reduce ci cost.
- if "3.10" in sys.version:
- subprocess.run(
- ["bash", f"{current_dir}/start_ollama_server.sh", test_model],
- timeout=300,
- check=True,
- )
- client = Client()
- models = client.list()
-
- model_found = False
- for model in models["models"]:
- if model.model == test_model:
- model_found = True
- break
-
- if not model_found:
- client = None # type: ignore
-except Exception:
- client = None # type: ignore
+
+client = pull_model(test_model)
@pytest.mark.skipif(
diff --git
a/python/flink_agents/integrations/embedding_models/local/tests/start_ollama_server.sh
b/python/flink_agents/integrations/embedding_models/local/tests/start_ollama_server.sh
deleted file mode 100755
index 92da52d7..00000000
---
a/python/flink_agents/integrations/embedding_models/local/tests/start_ollama_server.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-################################################################################
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-################################################################################
-
-# only works on linux
-os=$(uname -s)
-echo $os
-if [[ $os == "Linux" ]]; then
- curl -fsSL https://ollama.com/install.sh | sh
- ret=$?
- if [ "$ret" != "0" ]
- then
- exit $ret
- fi
-
- if curl -f http://localhost:11434/api/tags >/dev/null 2>&1; then
- echo "Ollama is already running"
- else
- echo "Starting Ollama server"
- ollama serve &
- sleep 10 # wait for ollama to start
- fi
-
- ollama pull all-minilm:22m
-fi
\ No newline at end of file
diff --git
a/python/flink_agents/integrations/embedding_models/local/tests/test_ollama_embedding_model.py
b/python/flink_agents/integrations/embedding_models/local/tests/test_ollama_embedding_model.py
index dd71c14c..bcf77f18 100644
---
a/python/flink_agents/integrations/embedding_models/local/tests/test_ollama_embedding_model.py
+++
b/python/flink_agents/integrations/embedding_models/local/tests/test_ollama_embedding_model.py
@@ -16,16 +16,13 @@
# limitations under the License.
################################################################################
import os
-import subprocess
-import sys
-from pathlib import Path
from unittest.mock import MagicMock
import pytest
-from ollama import Client
from flink_agents.api.resource import Resource, ResourceType
from flink_agents.api.resource_context import ResourceContext
+from flink_agents.e2e_tests.test_utils import pull_model
from flink_agents.integrations.embedding_models.local.ollama_embedding_model
import (
OllamaEmbeddingModelConnection,
OllamaEmbeddingModelSetup,
@@ -34,27 +31,8 @@ from
flink_agents.integrations.embedding_models.local.ollama_embedding_model imp
pytestmark = pytest.mark.integration
test_model = os.environ.get("OLLAMA_EMBEDDING_MODEL", "all-minilm:22m")
-current_dir = Path(__file__).parent
-try:
- # only auto setup ollama in ci with python 3.10 to reduce ci cost.
- if "3.10" in sys.version:
- subprocess.run(
- ["bash", f"{current_dir}/start_ollama_server.sh"], timeout=300,
check=True
- )
- client = Client()
- models = client.list()
-
- model_found = False
- for model in models["models"]:
- if model.model == test_model:
- model_found = True
- break
-
- if not model_found:
- client = None # type: ignore
-except Exception:
- client = None # type: ignore
+client = pull_model(test_model)
@pytest.mark.skipif(