Skip to content

test: add test suite and CI workflow (71 tests)#206

Open
kmr-rohit wants to merge 6 commits into
kubeflow:mainfrom
kmr-rohit:feat/test-infra
Open

test: add test suite and CI workflow (71 tests)#206
kmr-rohit wants to merge 6 commits into
kubeflow:mainfrom
kmr-rohit:feat/test-infra

Conversation

@kmr-rohit
Copy link
Copy Markdown

Summary

  • 71 tests across 3 modules covering MCP server tools, pipeline utilities, and issue processing
  • GitHub Actions CI running pytest on Python 3.9, 3.11, 3.12
  • Fast execution (<4s) — heavy deps (pymilvus, sentence_transformers) mocked at import time, no GPU/model downloads needed

Test coverage

Module Tests Covers
test_mcp_server.py 30 All 3 MCP tools, _search_collection helper, _init() idempotency, filter params
test_pipeline_utils.py 18 clean_content() — Hugo frontmatter, HTML tags, template syntax, edge cases
test_issues_pipeline.py 23 parse_issue_metadata, build_metadata_prefix, split_issue_into_chunks

Files added

  • tests/conftest.py — shared fixtures (mock MilvusClient, SentenceTransformer, sample Milvus hits)
  • tests/test_mcp_server.py, tests/test_pipeline_utils.py, tests/test_issues_pipeline.py
  • .github/workflows/tests.yml — CI workflow
  • requirements-test.txt — test dependencies

Depends on #205 for the feature code being tested.

Test plan

  • CI workflow passes on all 3 Python versions
  • python -m pytest tests/ -v passes locally (71/71)
  • No real network calls or heavy model downloads in test execution

@google-oss-prow google-oss-prow Bot requested a review from chasecadet May 6, 2026 14:52
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chasecadet for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

kmr-rohit added 2 commits May 6, 2026 20:34
… search tools

MCP server (server.py):
- Shared _search_collection helper for all Milvus queries
- search_github_issues: semantic search over GitHub issues with repo/state filters
- search_kubeflow_code: semantic search over YAML manifests and Python source
- Lazy initialization of SentenceTransformer and MilvusClient

Ingestion pipelines:
- issues-pipeline.py: KFP pipeline for GitHub issues with comment-boundary chunking
- issues_utils.py: metadata parsing and chunking logic (testable outside KFP)
- code-pipeline.py: KFP pipeline with YAML-aware and Python AST-aware chunking
- code_utils.py: file routing, YAML document splitting, AST parsing
- utils.py: shared clean_content() for Hugo/HTML doc preprocessing

Agent CRD (setup.yaml):
- All 3 tools wired to kubeflow-docs-mcp RemoteMCPServer
- Updated systemMessage with multi-tool routing strategy

Scripts:
- index_real_issues.py: standalone GitHub issues indexing script

Misc:
- Add .claude/ to .gitignore

Signed-off-by: Rohit Kumar <rr7433446@gmail.com>
Test modules:
- test_mcp_server.py: MCP tool contracts, _search_collection, _init() idempotency
- test_pipeline_utils.py: clean_content() Hugo/HTML preprocessing edge cases
- test_issues_pipeline.py: issue metadata parsing, comment-boundary chunking

Infrastructure:
- conftest.py: shared fixtures (mock MilvusClient, SentenceTransformer, sample hits)
- .github/workflows/tests.yml: pytest on Python 3.9, 3.11, 3.12
- requirements-test.txt: test dependencies (pytest, numpy)

All 71 tests pass. Heavy deps (pymilvus, sentence_transformers) are mocked
at import time to keep tests fast (<4s) with no GPU/model downloads needed.

Signed-off-by: Rohit Kumar <rr7433446@gmail.com>
kmr-rohit added 4 commits May 18, 2026 13:20
Add lean CI gates and behavior-focused tests for active MCP and code-ingestion paths so first PR validation is useful without publishing or deployment automation.
Allow the lean CI workflow to run on feat/test-infra so fork PRs can exercise the test suite before targeting main.
Run the first PR safety pytest job on Python 3.11 because FastMCP does not publish Python 3.9 wheels.
Use standard per-file ignore table syntax so pytest and other TOML readers can parse pyproject.toml in CI.
Copy link
Copy Markdown

@ArshVermaGit ArshVermaGit left a comment

Choose a reason for hiding this comment

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

Really solid test coverage overall — the scope feels well balanced across MCP tooling, pipeline utilities, and issue processing, and I like that the tests stay fast by mocking heavy dependencies at import time instead of relying on real model downloads or external services. The CI setup across multiple Python versions is also a nice touch and should help catch compatibility issues early. The coverage around edge cases in clean_content() and chunking/metadata handling especially stands out since those tend to be areas where regressions quietly slip in. Given the passing local + CI runs and the isolated test design, this looks in great shape to merge once #205 lands.

@cursor cursor Bot deleted the feat/test-infra branch May 28, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants