test: add a new test for mcp named query with default server#1365
test: add a new test for mcp named query with default server#1365dbasunag merged 3 commits intoopendatahub-io:mainfrom
Conversation
Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com> Co-Authored-By: Claude <noreply@anthropic.com>
|
The following are automatically added/executed:
Available user actions:
Supported labels{'/hold', '/build-push-pr-image', '/cherry-pick', '/lgtm', '/verified', '/wip'} |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA new pytest class, Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/model_registry/mcp_servers/config/test_named_queries.py (1)
103-103: Docstring should use Given-When-Then format.The test docstring is too terse and doesn't follow the Given-When-Then structure required by project standards.
Proposed fix
- """Validate that MCP filter_options does not return any namedQueries.""" + """Validate that MCP filter_options does not return any namedQueries. + + Given: A default MCP server deployment with the filter_options endpoint available. + When: The mcp_servers/filter_options endpoint is queried. + Then: The response should not contain any namedQueries field or the field should be empty. + """As per coding guidelines: "each test/class must have a docstring (Google format, Given-When-Then if feasible)" (CONSTITUTION) and "use Given-When-Then in the docstring" (AGENTS).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/model_registry/mcp_servers/config/test_named_queries.py` at line 103, Replace the terse docstring """Validate that MCP filter_options does not return any namedQueries.""" with a Given-When-Then formatted docstring for the test that validates MCP filter_options behavior: state the Given (e.g., given an MCP server or configuration without named queries), the When (when calling filter_options on the MCP), and the Then (then assert that no namedQueries are returned). Update the test function's docstring (the one referencing "MCP filter_options" / "namedQueries") to follow that structure in Google style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/model_registry/mcp_servers/config/test_named_queries.py`:
- Around line 94-96: Add the required pytest markers to the
TestMCPServerFilterOptionsNamedQueries class so it follows project standards:
add the component marker (e.g., `@pytest.mark.model_registry`) and the appropriate
tier marker from pytest.ini (e.g., `@pytest.mark.unit` or `@pytest.mark.integration`
as applicable); you can mirror the style used by TestMCPServerNamedQueries
(which uses `@pytest.mark.usefixtures`("mcp_servers_configmap_patch")) but you do
not need to add that fixture if it's not required—just ensure the class
TestMCPServerFilterOptionsNamedQueries has the component and tier markers
applied.
---
Nitpick comments:
In `@tests/model_registry/mcp_servers/config/test_named_queries.py`:
- Line 103: Replace the terse docstring """Validate that MCP filter_options does
not return any namedQueries.""" with a Given-When-Then formatted docstring for
the test that validates MCP filter_options behavior: state the Given (e.g.,
given an MCP server or configuration without named queries), the When (when
calling filter_options on the MCP), and the Then (then assert that no
namedQueries are returned). Update the test function's docstring (the one
referencing "MCP filter_options" / "namedQueries") to follow that structure in
Google style.
🪄 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: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: fcbad118-e282-42ea-8f4c-1a0529dedcde
📒 Files selected for processing (1)
tests/model_registry/mcp_servers/config/test_named_queries.py
Signed-off-by: Debarati Basu-Nag <dbasunag@redhat.com> Co-Authored-By: Claude <noreply@anthropic.com>
|
Status of building tag latest: success. |
Pull Request
Summary
Related Issues
Please review and indicate how it has been tested
Additional Requirements
Summary by CodeRabbit