Skip to content

test: coverage for q search of mcp#1234

Merged
dbasunag merged 2 commits intoopendatahub-io:mainfrom
fege:q_search
Mar 17, 2026
Merged

test: coverage for q search of mcp#1234
dbasunag merged 2 commits intoopendatahub-io:mainfrom
fege:q_search

Conversation

@fege
Copy link
Copy Markdown
Contributor

@fege fege commented Mar 17, 2026

Pull Request

Summary

Related Issues

  • Fixes:
  • JIRA: RHOAIENG-52378

How it has been tested

  • Locally
  • Jenkins

Additional Requirements

  • If this PR introduces a new test image, did you create a PR to mirror it in disconnected environment?
  • If this PR introduces new marker(s)/adds a new component, was relevant ticket created to update relevant Jenkins job?

Summary by CodeRabbit

  • Tests
    • Added keyword search validation tests for MCP servers when combined with filter parameters.

Signed-off-by: fege <fmosca@redhat.com>
@github-actions
Copy link
Copy Markdown

The following are automatically added/executed:

  • PR size label.
  • Run pre-commit
  • Run tox
  • Add PR author as the PR assignee
  • Build image based on the PR

Available user actions:

  • To mark a PR as WIP, add /wip in a comment. To remove it from the PR comment /wip cancel to the PR.
  • To block merging of a PR, add /hold in a comment. To un-block merging of PR comment /hold cancel.
  • To mark a PR as approved, add /lgtm in a comment. To remove, add /lgtm cancel.
    lgtm label removed on each new commit push.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To Cherry-pick a merged PR /cherry-pick <target_branch_name> to the PR. If <target_branch_name> is valid,
    and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
  • To build and push image to quay, add /build-push-pr-image in a comment. This would create an image with tag
    pr-<pr_number> to quay repository. This image tag, however would be deleted on PR merge or close action.
Supported labels

{'/wip', '/build-push-pr-image', '/hold', '/lgtm', '/verified', '/cherry-pick'}

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

A new test module is introduced for MCP server keyword search functionality, containing a parameterized test that validates keyword search behavior when combined with filter or named queries using GET requests to the mcp_servers endpoint.

Changes

Cohort / File(s) Summary
New Test Module
tests/model_registry/mcp_servers/search/test_keyword_search.py
Adds keyword search test suite with parameterized test_keyword_search_combined method. Constructs GET requests to mcp_servers endpoint and validates server name responses against expected sets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is incomplete. The Summary section contains only a comment placeholder with no actual content describing the changes or their purpose. Complete the Summary section with a brief description of what changes are being made and why they are needed. Currently, it only contains a template comment without substantive information.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test: coverage for q search of mcp' is concise and directly references the main change - adding test coverage for keyword search ('q' parameter) functionality in MCP servers.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

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.

🧹 Nitpick comments (1)
tests/model_registry/mcp_servers/search/test_keyword_search.py (1)

44-46: Assert response schema before dereferencing server["name"].

Line 45 assumes every item is a dict with name; malformed/error payloads produce opaque failures. Add explicit payload contract checks first.

Proposed hardening
-        items = response.get("items", [])
-        actual_names = {server["name"] for server in items}
+        items = response.get("items")
+        assert isinstance(items, list), f"Unexpected response payload: {response}"
+        assert all(isinstance(server, dict) and "name" in server for server in items), (
+            f"One or more items are missing `name`: {items}"
+        )
+        actual_names = {server["name"] for server in items}

As per coding guidelines, “REVIEW PRIORITIES: 3. Bug-prone patterns and error handling gaps.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/model_registry/mcp_servers/search/test_keyword_search.py` around lines
44 - 46, Before dereferencing server["name"], validate the response/item schema:
ensure response.get("items") is a list and each item is a dict containing a
"name" key. Update the assertion block around items/actual_names (variables:
response, items, actual_names, expected_names) to first assert isinstance(items,
list) and for each server assert isinstance(server, dict) and "name" in server,
then build actual_names from server["name"] and compare to expected_names; fail
with clear messages if the contract is violated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/model_registry/mcp_servers/search/test_keyword_search.py`:
- Around line 44-46: Before dereferencing server["name"], validate the
response/item schema: ensure response.get("items") is a list and each item is a
dict containing a "name" key. Update the assertion block around
items/actual_names (variables: response, items, actual_names, expected_names) to
first assert isinstance(items, list) and for each server assert
isinstance(server, dict) and "name" in server, then build actual_names from
server["name"] and compare to expected_names; fail with clear messages if the
contract is violated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 02f0bbf4-8332-426e-8726-3fd8dfba8ab6

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3cb17 and 6b0e158.

📒 Files selected for processing (1)
  • tests/model_registry/mcp_servers/search/test_keyword_search.py

@dbasunag dbasunag merged commit f44bd9a into opendatahub-io:main Mar 17, 2026
10 checks passed
@fege fege deleted the q_search branch March 17, 2026 13:56
@github-actions
Copy link
Copy Markdown

Status of building tag latest: success.
Status of pushing tag latest to image registry: success.

ssaleem-rh pushed a commit to ssaleem-rh/opendatahub-tests that referenced this pull request Mar 23, 2026
Signed-off-by: fege <fmosca@redhat.com>
Co-authored-by: Debarati Basu-Nag <dbasunag@redhat.com>
Signed-off-by: Shehan Saleem <ssaleem@redhat.com>
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.

4 participants