Repository navigation
feat: add integration tests for Langflow agent (RHAIENG-4033) - #243
Conversation
…HAIENG-4033) Pre-deployed (flow-import) agent — tests only verify the already-running route's /health endpoint returns HTTP 200. No build/deploy lifecycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds integration test support for the langflow simple-tool-calling-agent: pytest fixtures resolve its deployed route, a health-check test validates it, and the Makefile, CI workflow, and agent documentation are updated. ChangesIntegration test for simple tool calling agent
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Langflow's /health is served by uvicorn before the app is ready; /health_check validates DB + chat connectivity and returns structured JSON. Aligns with the shared utility pattern used by all other agents. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Match the agentic_rag pattern: `import integration.conftest` instead of `from integration.conftest import ...` when the fixture is also used as a parameter in the same file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@agents/langflow/templates/simple_tool_calling_agent/tests/integration/conftest.py`:
- Line 5: The test conftest currently only imports integration.conftest, which
does not register its fixtures for pytest and prevents deployed_agent from
resolving cluster_auth. Update this conftest.py to load the shared fixture
module properly by using pytest_plugins with integration.conftest, or explicitly
import the fixture symbols needed (cluster_auth and repo_root) so they are
available to the local test namespace.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 8bdb0d22-f642-4cb9-9f6a-ad8a1c2d9516
📒 Files selected for processing (4)
.github/workflows/agent-deployment-test.yamlagents/langflow/templates/simple_tool_calling_agent/Makefileagents/langflow/templates/simple_tool_calling_agent/tests/integration/conftest.pyagents/langflow/templates/simple_tool_calling_agent/tests/integration/test_deployment.py
shricharan-ks
left a comment
There was a problem hiding this comment.
Comprehensive Review — PR #243
JIRA: RHAIENG-4033 (could not access — redhat.atlassian.net requires auth; no Atlassian MCP configured)
Overview
This PR adds the first pre-deployed (Tier 3 / flow-import) integration test to the codebase. The Langflow agent has no Dockerfile, pyproject.toml, or build-openshift/deploy/undeploy Makefile targets, so the standard deploy-test-undeploy lifecycle doesn't apply. The approach of discovering an already-running route and health-checking it is the correct pattern for this agent type.
The PR is clean and well-scoped. Four files changed, 56 lines added. I have one blocking issue (fixture import) and several non-blocking observations.
🔴 Blocking: Fixture import will break at runtime
File: conftest.py:5
import integration.conftest # noqa: F401 — re-exports cluster_auth, repo_rootThis does not actually re-export the fixtures. Pytest discovers fixtures by scanning a conftest.py module's __dict__ for @pytest.fixture-decorated functions. A bare import integration.conftest loads the module but puts nothing in the local module's namespace — cluster_auth and repo_root remain in integration.conftest.__dict__, not in this file's __dict__.
Every other agent in the repo uses the explicit pattern:
# Re-export shared integration fixtures so pytest discovers them.
from integration.conftest import cluster_auth, repo_root # noqa: F401This works in react_agent, human_in_the_loop, adk, crewai/websearch, and agentic_rag. The deployed_agent fixture in this PR depends on cluster_auth — without proper re-export, pytest will fail with fixture 'cluster_auth' not found.
The commit message says this was done to avoid ruff F811 (redefinition), but the standard pattern with # noqa: F401 suppresses the linting issue and is proven across the codebase.
Fix: Replace line 5 with:
from integration.conftest import cluster_auth, repo_root # noqa: F401🟡 Non-blocking observations
1. Health endpoint path divergence — verify against live cluster
The test uses /health_check:
result = health_check(f"{deployed_agent}/health_check", retries=12, backoff=5.0)Every other agent uses /health. The local deploy-local.sh also polls http://localhost:7860/health (not /health_check). Langflow does expose both endpoints, but their response schemas differ by version:
/health→{"status": true}(some versions)/health_check→{"status": "ok"}(newer versions)
The assertion result["status"] == "ok" needs to be validated against the actual deployed Langflow version on the demo cluster. Since the test plan shows the test was only verified as "SKIPPED without cluster", this path hasn't been confirmed end-to-end yet.
Suggestion: Confirm against the live cluster post-merge (as noted in the test plan). Consider whether /health (which deploy-local.sh uses) might be more robust across Langflow versions.
2. CI env vars are unnecessary for this agent
The CI workflow injects API_KEY, BASE_URL, MODEL_ID for all matrix entries. The Langflow agent doesn't use any of these (it's pre-deployed and uses Ollama/OGX locally). This is harmless — unused env vars won't break anything — but worth noting for future readers.
No action needed unless you want to add a matrix.include entry that nulls them out.
3. Missing __init__.py — consistent with react_agent but not most agents
4 of 5 existing agents have __init__.py in tests/integration/. The PR omits it, citing circular import risk for agents without pyproject.toml. This matches react_agent (which also omits it) but diverges from the majority.
The PR description's rationale is sound — without a pyproject.toml, the test runner may resolve integration to the local package rather than the shared one. No action needed.
4. Pre-deployed assumption needs CI orchestration
The deployed_agent fixture calls pytest.fail() if the route doesn't exist — it doesn't deploy the agent itself. This means the nightly CI run requires the Langflow agent to be pre-deployed on the demo cluster before this job runs. If the agent goes down or gets redeployed, the test will fail with "Pre-deployed agent route not found" rather than deploying fresh.
The test plan acknowledges this ("Nightly CI run passes on demo cluster (post-merge)"). Just flagging that this creates a dependency on cluster state that other integration tests don't have.
✅ What looks good
- Clean separation of pre-deployed fixture pattern from the standard deploy/undeploy lifecycle
- Correct use of shared utilities (
resolve_agent_dir,load_agent_name,get_route,health_check) uv run --withis the right approach for agents withoutpyproject.toml— avoids creating a package just for test deps- Makefile target follows the
test-integrationnaming convention and JUnit XML output - CI matrix entry is minimal and correct — no special includes needed
- Retry/backoff config (12 retries, 5s backoff, exponential with 15s cap) is identical to other agents
Summary
Fix the fixture import (blocking), verify the health endpoint path against the live cluster, and this is ready to merge. Good first integration test for a non-standard agent type.
Keep both entries: a2a-langgraph-crewai (from main) and langflow-simple-tool-calling-agent (from this branch). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
shricharan-ks
left a comment
There was a problem hiding this comment.
Code Review — PR #243 (medium effort, 8 angles, verified)
This PR adds the repo's first pre-deployed integration test for the Langflow Simple Tool Calling Agent — a Tier 3 flow-import agent that skips the standard build/deploy/undeploy lifecycle. It adds a test-integration Makefile target, pytest fixtures that discover an already-running route, a health-check test, and a CI matrix entry. 4 files changed, 56 lines added.
Findings (6 survived verification, most severe first)
1. 🔴 conftest.py:5 — Fixture import breaks test collection (CONFIRMED)
import integration.conftest # noqa: F401 — re-exports cluster_auth, repo_rootDoes not actually re-export fixtures. Pytest discovers fixtures by scanning a conftest.py module's __dict__. Bare import integration.conftest imports the module object but does NOT place cluster_auth or repo_root into the local namespace. The deployed_agent fixture on line 30 depends on cluster_auth — pytest will error with fixture 'cluster_auth' not found at collection time.
Verified by reproduction: built an exact reproduction with uv run --with pytest and PYTHONPATH matching the CI Makefile. Only from integration.conftest import cluster_auth, repo_root works. The presence/absence of __init__.py makes no difference.
Note: agentic_rag/tests/integration/conftest.py (line 6) has the same bare-import pattern — it's a latent bug there too (not in the CI matrix, so never caught).
Fix: from integration.conftest import cluster_auth, repo_root # noqa: F401
2. 🟡 test_deployment.py:9 — /health_check endpoint and "ok" status unverified (PLAUSIBLE)
result = health_check(f"{deployed_agent}/health_check", retries=12, backoff=5.0)
assert result["status"] == "ok"Langflow does expose both /health and /health_check, but:
- The agent's own
deploy-local.shpolls/health(not/health_check) - Every other agent tests against
/healthand asserts"healthy" - The PR test plan shows the test was only run as SKIPPED (no cluster)
If the deployed Langflow version returns a different response shape, the assertion fails after exhausting 12 retries (~165s) — a slow, misleading CI failure. The author deliberately chose /health_check in commit f602a43b, so this may be intentional and correct, but it hasn't been validated end-to-end yet.
3. 🟡 AGENTS.md:61 — Non-standard agents section is now stale (CONFIRMED)
AGENTS.md documents this agent as having "No Dockerfile, pyproject.toml, main.py, src/, or tests/." This PR adds tests/integration/ but does not update AGENTS.md. The documentation should reflect the new tests/ directory.
4. 🟡 conftest.py:29 — Pre-deployed fixture should be shared (PLAUSIBLE)
The deployed_agent fixture body is 8 lines of generic get-route-or-fail logic with zero Langflow-specific code. When the a2a agent or next Compose-based agent needs the same pre-deployed pattern, this fixture will be copy-pasted. Consider extracting it to tests/integration/utils.py or tests/integration/conftest.py as a shared factory.
5. 🟡 test_deployment.py:10 — Weaker assertion than other agents (PLAUSIBLE)
Every other agent asserts both result["status"] == "healthy" and result["agent_initialized"] is True. This test only checks status. If the Langflow health response includes an initialization flag, a half-initialized agent would pass the test. If Langflow genuinely doesn't return agent_initialized, this is fine but should be noted with a comment.
6. 🟡 agent-deployment-test.yaml:1-4 — Workflow description inaccurate (CONFIRMED)
The header comment says "deploys each agent via build-openshift + Helm, validates GET /health, and tears down." The Langflow entry does none of this — it only discovers a pre-existing route and checks /health_check. A maintainer reading the description would not realize the Langflow entry has different semantics and requires external pre-deployment.
Summary
1 blocking (fixture import — test will not run), 5 non-blocking observations. Fix the import on line 5, update AGENTS.md, and consider the health endpoint/assertion questions. The pre-deployed pattern is a good addition — just needs the import fix to actually work.
Correction to Finding #2 —
|
- Use explicit `from integration.conftest import` for fixture discovery (noqa: F811 on the fixture parameter to suppress redefinition warning) - Update AGENTS.md to reflect tests/integration/ and test-integration target - Update CI workflow header to note pre-deployed agent semantics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AGENTS.md`:
- Line 71: Update the langflow/templates/simple_tool_calling_agent bullet in
AGENTS.md to explicitly identify the pre-deployed readiness endpoint as GET
/health_check, distinguishing it from the standard GET /health contract while
preserving the existing deployment and workflow details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 60914a78-8880-400d-8ee8-8b35fc384a43
📒 Files selected for processing (3)
.github/workflows/agent-deployment-test.yamlAGENTS.mdagents/langflow/templates/simple_tool_calling_agent/tests/integration/conftest.py
🚧 Files skipped from review as they are similar to previous changes (2)
- agents/langflow/templates/simple_tool_calling_agent/tests/integration/conftest.py
- .github/workflows/agent-deployment-test.yaml
| Several agents diverge significantly from the standard pattern: | ||
|
|
||
| **langflow/templates/simple_tool_calling_agent** - Podman Compose flow-import deployment, not standalone FastAPI. No Dockerfile, pyproject.toml, main.py, src/, or tests/. Different Makefile targets (`init`, `ollama`, `run`, `stop`, `clean`). Uses infra-only env vars (PostgreSQL, Langfuse, Ollama) -- not `API_KEY`/`BASE_URL`/`MODEL_ID`. | ||
| **langflow/templates/simple_tool_calling_agent** - Podman Compose flow-import deployment, not standalone FastAPI. No Dockerfile, pyproject.toml, main.py, or src/. Has `tests/integration/` (pre-deployed health check only). Different Makefile targets (`init`, `ollama`, `run`, `stop`, `clean`, `test-integration`). Uses infra-only env vars (PostgreSQL, Langfuse, Ollama) -- not `API_KEY`/`BASE_URL`/`MODEL_ID`. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the actual readiness endpoint
This bullet should explicitly say GET /health_check, not just “pre-deployed health check”. The surrounding guidance defines GET /health as the standard contract, so the current wording is ambiguous and can send contributors to the wrong endpoint.
As per coding guidelines, agent-specific layout and workflow documentation should accurately describe this non-standard agent.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@AGENTS.md` at line 71, Update the
langflow/templates/simple_tool_calling_agent bullet in AGENTS.md to explicitly
identify the pre-deployed readiness endpoint as GET /health_check,
distinguishing it from the standard GET /health contract while preserving the
existing deployment and workflow details.
Source: Coding guidelines
There was a problem hiding this comment.
Fixed in e1db125 — updated the langflow entry to reflect tests/integration/ and the test-integration Makefile target.
Assisted by Claude Opus 4.6 (1M context)
There was a problem hiding this comment.
@mpk-droid Thanks for the update! Looking at the current wording — "Has tests/integration/ (pre-deployed health check only)" — it still doesn't explicitly name the GET /health_check endpoint, which was the core ask (to avoid ambiguity with the standard GET /health contract mentioned elsewhere in the doc). If that's an intentional simplification, that's fine, but if you'd like it fully explicit, something like:
Has `tests/integration/` (verifies `GET /health_check` readiness endpoint only).would remove any ambiguity for future contributors.
|
Thanks for the thorough reviews @shricharan-ks — all addressed in e1db125: #1 (Blocking — fixture import): Fixed. Switched back to #2 ( #3 (AGENTS.md stale): Fixed. Updated the langflow entry to reflect #4 (Extract shared pre-deployed fixture): Acknowledged — will defer to a follow-up when we add the next pre-deployed agent. #5 (Weaker assertion): Noted your withdrawal — Langflow's #6 (Workflow header comment): Fixed. Updated the header to note that pre-deployed agents skip build/deploy and only verify health on an already-running route. Assisted by Claude Opus 4.6 (1M context) |
shricharan-ks
left a comment
There was a problem hiding this comment.
Re-review — All findings addressed ✅
The fix commit e1db125c resolves all 3 actionable findings from the previous review:
- Fixture import — now uses
from integration.conftest import cluster_auth, repo_root # noqa: F401(confirmed correct) - AGENTS.md — updated to reflect
tests/integration/andtest-integrationtarget - CI workflow comment — updated to mention pre-deployed agents
Re-reviewed across 8 angles (line-by-line, removed-behavior, cross-file, reuse, simplification, efficiency, altitude, conventions). No actionable findings survive verification.
LGTM — ready to merge.
Summary
/healthreturns HTTP 200 (no build/deploy/undeploy lifecycle)uv run --withfor test deps since this agent has nopyproject.tomltests/integration/__init__.py— intentionally omitted to prevent the localintegrationpackage from shadowing the shared one (agents without their ownpyproject.tomlhit a circular import otherwise)Changes
agents/langflow/templates/simple_tool_calling_agent/tests/integration/conftest.py— pre-deployed fixtureagents/langflow/templates/simple_tool_calling_agent/tests/integration/test_deployment.py— HTTP 200 health checkagents/langflow/templates/simple_tool_calling_agent/Makefile—test-integrationtarget.github/workflows/agent-deployment-test.yaml— matrix entryTest plan
make test-integrationcollects 1 test (SKIPPED without cluster — expected)🤖 Generated with Claude Code
Assisted by Claude Opus 4.6 (1M context)