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
1 change: 1 addition & 0 deletions .github/workflows/agent-deployment-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
agent:
- { name: langgraph-react-agent, dir: agents/langgraph/react_agent }
- { name: langgraph-hitl-agent, dir: agents/langgraph/human_in_the_loop }
- { name: crewai-websearch-agent, dir: agents/crewai/websearch_agent }
env:
API_KEY: ${{ vars.API_KEY }}
BASE_URL: ${{ vars.BASE_URL }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ STATUS.md
.e2e-workdir
evals/evalhub_adapter/eval-*.yaml
evals/evalhub_adapter/provider-*.json
results.xml
9 changes: 7 additions & 2 deletions agents/crewai/websearch_agent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VALUES_FILE := values.yaml
CONTAINER_CLI := $(shell command -v podman 2>/dev/null || command -v docker 2>/dev/null)
MODEL ?= llama3.1:8b

.PHONY: init re-init env ollama llama-server run-app run-app-fresh run-cli build push build-openshift deploy undeploy test dry-run help
.PHONY: init re-init env ollama llama-server run-app run-app-fresh run-cli build push build-openshift deploy undeploy test test-integration dry-run help

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}'
Expand Down Expand Up @@ -168,4 +168,9 @@ undeploy: ## Remove deployment from cluster
helm uninstall $(AGENT_NAME)

test: ## Run tests
uv run --extra dev python -m pytest tests/
uv run --extra dev python -m pytest tests/ --ignore=tests/integration

test-integration: ## Run integration deployment test
PYTHONPATH=$$(git rev-parse --show-toplevel)/tests \
uv run --extra dev python -m pytest tests/integration/test_deployment.py \
-v --tb=long --junitxml=results.xml
1 change: 1 addition & 0 deletions agents/crewai/websearch_agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies = [

[project.optional-dependencies]
dev = [
"httpx>=0.27",
"pytest>=9.0.2",
]
tracing = [
Expand Down
Empty file.
2 changes: 2 additions & 0 deletions agents/crewai/websearch_agent/tests/integration/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Re-export shared integration fixtures so pytest discovers them.
from integration.conftest import cluster_auth, repo_root # noqa: F401
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
from __future__ import annotations

import logging
import os

import pytest
from integration.utils import (
MakeTargetError,
RouteNotFoundError,
get_route,
health_check,
load_agent_name,
run_make,
)

logger = logging.getLogger(__name__)

INTERNAL_REGISTRY = "image-registry.openshift-image-registry.svc:5000"


@pytest.fixture(scope="module")
def agent_dir(repo_root):
return repo_root / "agents" / "crewai" / "websearch_agent"
Comment thread
mpk-droid marked this conversation as resolved.


@pytest.fixture(scope="module")
def agent_name(agent_dir):
return load_agent_name(agent_dir)


def _write_env_file(agent_dir, container_image):
"""Write a .env file so Makefile targets can source it."""
missing = [v for v in ("BASE_URL", "MODEL_ID") if v not in os.environ]
if missing:
pytest.fail(
f"Missing required env vars: {', '.join(missing)}. "
"Set them in the CI workflow or export locally."
)
env_path = agent_dir / ".env"
env_path.write_text(
f"API_KEY={os.environ.get('API_KEY', 'not-needed')}\n"
f"BASE_URL={os.environ['BASE_URL']}\n"
f"MODEL_ID={os.environ['MODEL_ID']}\n"
f"CONTAINER_IMAGE={container_image}\n"
)
return env_path


@pytest.fixture(scope="module")
def deployed_agent(cluster_auth, agent_dir, agent_name):
namespace = cluster_auth["namespace"]
container_image = f"{INTERNAL_REGISTRY}/{namespace}/{agent_name}:latest"
env_path = _write_env_file(agent_dir, container_image)

deployed = False
try:
logger.info("Building image on cluster via build-openshift...")
run_make("build-openshift", cwd=agent_dir, timeout=600)

logger.info("Deploying to cluster...")
run_make("deploy", cwd=agent_dir, timeout=300)
deployed = True

route_url = get_route(agent_name, namespace=namespace)
logger.info("Agent deployed at %s", route_url)

yield route_url

except (MakeTargetError, RouteNotFoundError) as exc:
pytest.fail(f"Deployment failed: {exc}")

finally:
if deployed:
logger.info("Tearing down deployment...")
try:
run_make("undeploy", cwd=agent_dir, timeout=120)
except MakeTargetError:
logger.warning(
"Cleanup failed — manual undeploy may be needed", exc_info=True
)
env_path.unlink(missing_ok=True)


@pytest.mark.integration
def test_health_endpoint(deployed_agent):
route_url = deployed_agent
result = health_check(f"{route_url}/health", retries=12, backoff=5.0)

assert result["status"] == "healthy"
assert result["agent_initialized"] is True
Loading