Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -37,29 +34,8 @@
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,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script start_ollama_server.sh installs the Ollama server and pulls the required models. After moving the integration tests into the it-python pipeline, we no longer need to install the Ollama server separately; however, we still need to pull the test models being used. We can use the pull_model method in test_utils.py.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch -tools/start_ollama_server.sh only installs the server; it doesn't pull models, so after dropping the inline block these tests would skip on a missing model in CI rather than actually run.

Switched both files to client = pull_model(test_model) from e2e_tests/test_utils.py — the same helper the e2e integration tests already use. It pulls the model and returns the client (or None), so the existing skipif(client is None) guard is unchanged. Also dropped the now-unused from ollama import Client.

Verified locally: the embedding test now runs instead of skipping. Fixed in 3b8d9e1.

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(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -34,27 +31,8 @@
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
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here too — same pull_model(test_model) switch as the chat test. 3b8d9e1

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(
Expand Down
Loading