Skip to content

RHAIENG-4029: add tier-2 integration test for agentic RAG agent#101

Merged
mpk-droid merged 8 commits into
mainfrom
feat/RHAIENG-4029-agentic-rag-integration-test
May 19, 2026
Merged

RHAIENG-4029: add tier-2 integration test for agentic RAG agent#101
mpk-droid merged 8 commits into
mainfrom
feat/RHAIENG-4029-agentic-rag-integration-test

Conversation

@mpk-droid
Copy link
Copy Markdown
Contributor

@mpk-droid mpk-droid commented May 13, 2026

Ticket

RHAIENG-4029

Summary

  • Adds integration deployment test for the LangGraph Agentic RAG agent (tier 2), which validates RAG-specific env vars (EMBEDDING_MODEL, VECTOR_STORE_ID, EMBEDDING_DIMENSION, VECTOR_STORE_PROVIDER) before deploying, unlike tier-1 tests that only need BASE_URL/MODEL_ID
  • Adds test-integration Makefile target and fixes test target to ignore the integration directory
  • Test assumes Milvus is pre-provisioned on the cluster; no functional RAG query is performed — scope is health-check only

Test plan

  • cd agents/langgraph/agentic_rag && make test — unit tests pass (ignoring integration dir)
  • make test-integration — integration test runs on demo cluster with required env vars exported
  • Verify test fails fast with clear message when RAG-specific env vars are missing
  • Verify teardown (make undeploy) runs even on test failure (fixture finalizer pattern)

Add integration test that builds, deploys, and health-checks the
LangGraph Agentic RAG agent on OpenShift. Unlike tier-1 agents, this
test validates RAG-specific env vars (EMBEDDING_MODEL, VECTOR_STORE_ID,
EMBEDDING_DIMENSION, VECTOR_STORE_PROVIDER) are present before
attempting deployment, and writes them to .env so the Helm deploy
target passes them through to the pod.

Also fixes the `make test` target to ignore the integration directory,
preventing import errors when running unit tests locally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

Review Change Stack

Warning

Rate limit exceeded

@mpk-droid has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 41 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 040a0279-8f9f-4ee9-a47d-193ecaaf27e4

📥 Commits

Reviewing files that changed from the base of the PR and between 332a400 and 0e456ef.

📒 Files selected for processing (1)
  • agents/langgraph/agentic_rag/tests/integration/conftest.py
📝 Walkthrough

Walkthrough

This PR adds integration testing for agentic_rag: a Makefile test-integration target, pytest fixtures that build/deploy the agent and yield its route, an integration health-check test, and updates to redact VECTOR_STORE_ID in test logs.

Changes

Deployment Integration Testing

Layer / File(s) Summary
Test execution targets and fixture discovery
agents/langgraph/agentic_rag/Makefile, agents/langgraph/agentic_rag/tests/integration/conftest.py
Makefile adds test-integration and updates test to exclude integration/behavioral tests; conftest imports and re-exports shared integration fixtures for pytest discovery.
Deployment orchestration and health verification
agents/langgraph/agentic_rag/tests/integration/conftest.py, agents/langgraph/agentic_rag/tests/integration/test_deployment.py
Fixtures validate required RAG env vars, write agent .env, build and deploy via make targets, discover route URL, manage cleanup (undeploy and env removal), and test_health_endpoint asserts /health returns status == "healthy" and agent_initialized is True.
Secure logging for vector store credentials
tests/integration/utils.py
Redaction patterns extended to mask VECTOR_STORE_ID in VECTOR_STORE_ID=... and --set env.VECTOR_STORE_ID=... formats.

Sequence Diagram

sequenceDiagram
  participant Fixture as deployed_agent fixture
  participant Make as Makefile (build/deploy)
  participant Route as Route discovery
  participant Test as test_health_endpoint
  participant Agent as Deployed agent service

  Fixture->>Fixture: write .env with RAG config
  Fixture->>Make: make build-openshift
  Fixture->>Make: make deploy
  Fixture->>Route: get_route(agent_name)
  Route-->>Fixture: agent URL
  Fixture->>Test: yield agent URL
  Test->>Agent: GET /health
  Agent-->>Test: {status, agent_initialized}
  Test->>Test: assert status==healthy AND agent_initialized==True
  Fixture->>Make: make undeploy (cleanup)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a tier-2 integration test for the agentic RAG agent, which is the primary objective of the changeset.
Description check ✅ Passed The description is well-structured, directly related to the changeset, and provides context about the integration test, environment variables, Makefile targets, test plan, and ticket reference.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/RHAIENG-4029-agentic-rag-integration-test

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Clarify why agent.yaml-optional vars are required in the integration
test, and extend _REDACT_PATTERNS to cover VECTOR_STORE_ID which may
contain connection strings with credentials.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mpk-droid mpk-droid marked this pull request as ready for review May 15, 2026 20:18
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/langgraph/agentic_rag/tests/integration/test_deployment.py`:
- Line 49: The EMBEDDING_DIMENSION value taken from os.environ.get in
test_deployment.py is written to the .env as-is and may be non-integer; update
the test to validate and normalize it by attempting to parse
int(os.environ.get('EMBEDDING_DIMENSION', '768')) (catch ValueError) and fall
back to 768 (or raise a clear assertion if you prefer strictness), then write
the normalized integer back into the .env string (e.g., use the validated int
converted to str for the f"EMBEDDING_DIMENSION=..." line); reference the
EMBEDDING_DIMENSION environment access and the code that constructs the
f"EMBEDDING_DIMENSION={...}" string to locate where to add the try/except and
normalization.

In `@tests/integration/utils.py`:
- Around line 28-29: The existing redaction regexes
re.compile(r"(VECTOR_STORE_ID=)\S+") and
re.compile(r"(--set\s+env\.VECTOR_STORE_ID=)\S+") only match unquoted values;
add the quoted-value counterparts to cover Helm/Makefile usage (e.g., add
re.compile(r'(VECTOR_STORE_ID=")[^"]+"') and
re.compile(r'(--set\s+env\\.VECTOR_STORE_ID=")[^"]+"') ) so deployment logs with
VECTOR_STORE_ID="$${VECTOR_STORE_ID}" are properly redacted.
🪄 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: 012f483d-5c4f-4d08-ac08-ca398e410942

📥 Commits

Reviewing files that changed from the base of the PR and between 50b4dec and c6ba0f7.

📒 Files selected for processing (5)
  • agents/langgraph/agentic_rag/Makefile
  • agents/langgraph/agentic_rag/tests/integration/__init__.py
  • agents/langgraph/agentic_rag/tests/integration/conftest.py
  • agents/langgraph/agentic_rag/tests/integration/test_deployment.py
  • tests/integration/utils.py

Comment thread agents/langgraph/agentic_rag/tests/integration/test_deployment.py Outdated
Comment thread tests/integration/utils.py
mpk-droid and others added 3 commits May 15, 2026 16:35
Keep main's updated test target (--ignore=tests/behavioral, PYTEST_ARGS)
alongside the new test-integration target.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ub.com:red-hat-data-services/agentic-starter-kits into feat/RHAIENG-4029-agentic-rag-integration-test
Validate EMBEDDING_DIMENSION as int before writing to .env, and add
quoted-format redaction pattern for VECTOR_STORE_ID to cover Helm
--set usage in deployment logs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@andrewdonheiser andrewdonheiser self-requested a review May 18, 2026 12:07
Copy link
Copy Markdown
Contributor

@tarun-etikala tarun-etikala left a comment

Choose a reason for hiding this comment

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

Looks Good overall. Suggestion to extract the test infrastructure later to reduce maintenance burden across multiple agents

Comment thread agents/langgraph/agentic_rag/tests/integration/test_deployment.py Outdated
tarun-etikala
tarun-etikala previously approved these changes May 18, 2026
Comment thread agents/langgraph/agentic_rag/tests/integration/test_deployment.py Outdated
Comment thread agents/langgraph/agentic_rag/tests/integration/test_deployment.py Outdated
- Move helpers (_write_env_file, INTERNAL_REGISTRY) and fixtures
  (agent_dir, agent_name, deployed_agent) to conftest.py so the test
  file contains only test functions (andrewdonheiser)
- Add broad `except Exception` fallback in deployed_agent fixture so
  unexpected errors surface clearly in CI (andrewdonheiser)
- Wrap EMBEDDING_DIMENSION int() cast with try/except and pytest.fail
  for a clear error message (tarun-etikala)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/langgraph/agentic_rag/tests/integration/conftest.py`:
- Line 7: The current direct imports cluster_auth and repo_root into this module
namespace cause a name collision with fixture arguments and trigger Ruff F811;
replace the direct-from import with a module-level import (e.g., import
integration.conftest as integration_conftest  # noqa: F401) or alias the
imported module so you do not introduce cluster_auth or repo_root symbols into
this file’s global namespace, leaving the fixture names available for use in
test function signatures (referencing the module import rather than the bare
symbols prevents the lint error).
- Around line 70-87: The fixture currently yields inside the try/except that
catches MakeTargetError/RouteNotFoundError and a broad Exception, so assertion
failures after yield get swallowed; to fix, wrap the deployment steps
(logger.info("Building image..." ), run_make("build-openshift"),
run_make("deploy"), get_route(...), setting deployed/route_url) in an inner try
that only catches MakeTargetError and RouteNotFoundError and calls pytest.fail
with the exception, keep teardown in a finally, then move the yield route_url
outside that inner try/except so test failures aren’t caught by the deployment
error handlers; reference run_make, get_route, deployed, route_url,
MakeTargetError, RouteNotFoundError when making the change.
🪄 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: 9dd4a0bb-96fe-4081-a305-32bc830b7425

📥 Commits

Reviewing files that changed from the base of the PR and between c6ba0f7 and b485260.

📒 Files selected for processing (4)
  • agents/langgraph/agentic_rag/Makefile
  • agents/langgraph/agentic_rag/tests/integration/conftest.py
  • agents/langgraph/agentic_rag/tests/integration/test_deployment.py
  • tests/integration/utils.py
✅ Files skipped from review due to trivial changes (1)
  • tests/integration/utils.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • agents/langgraph/agentic_rag/Makefile

Comment thread agents/langgraph/agentic_rag/tests/integration/conftest.py Outdated
Comment thread agents/langgraph/agentic_rag/tests/integration/conftest.py Outdated
- Use module import for shared fixtures to avoid F811 lint collision
  with fixture argument names
- Move yield outside exception handlers so test assertion failures
  aren't masked as "deployment errors"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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/langgraph/agentic_rag/tests/integration/conftest.py`:
- Around line 1-14: The import block in conftest.py is mis-sorted: third-party
import "pytest" must be separated from local package imports
"integration.conftest" and "integration.utils" by a blank line to satisfy lint
rules; edit the top of the file so there is a blank line between "import pytest"
and the subsequent "import integration.conftest  # noqa: F401" / "from
integration.utils import (... get_route, load_agent_name, run_make, ...)" lines,
preserving the existing names and comments.
🪄 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: 8bb6474f-dcb4-4dc0-b8a5-e9e8917a6db8

📥 Commits

Reviewing files that changed from the base of the PR and between b485260 and 332a400.

📒 Files selected for processing (1)
  • agents/langgraph/agentic_rag/tests/integration/conftest.py

Comment thread agents/langgraph/agentic_rag/tests/integration/conftest.py
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@tarun-etikala tarun-etikala left a comment

Choose a reason for hiding this comment

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

LGTM

@mpk-droid mpk-droid merged commit bdf5869 into main May 19, 2026
8 checks passed
@mpk-droid mpk-droid deleted the feat/RHAIENG-4029-agentic-rag-integration-test branch May 19, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants