Skip to content

[AI] Expand Test Coverage - mcp#2359

Draft
KCarretto wants to merge 1 commit into
mainfrom
expand-mcp-test-coverage-2613559184124500128
Draft

[AI] Expand Test Coverage - mcp#2359
KCarretto wants to merge 1 commit into
mainfrom
expand-mcp-test-coverage-2613559184124500128

Conversation

@KCarretto
Copy link
Copy Markdown
Collaborator

This PR focuses on increasing the test coverage of the tavern/internal/mcp module, which previously had low coverage (around 16%). The update introduces an export_test.go file within the package to expose internal functions such as tool handlers (handleListHosts, handleCreateQuest, etc.) and internal context keys. Extensive test cases were then added to mcp_test.go to test each handler.

Key achievements:

  • Coverage Increased: Increased the tavern/internal/mcp statement coverage from 16.2% to 78.3%.
  • Isolated Testing: Tests mock appropriate context clients and execute via export_test.go exposed functions without muddying the public API.
  • Flake Prevention: The new test cases have been executed locally 20 times to ensure determinism and stability.
  • Edge Cases Tested: The newly added tests cover success paths, parsing errors, invalid schemas, and DB client missing edge cases.

PR created automatically by Jules for task 2613559184124500128 started by @KCarretto

Added extensive test coverage for the `tavern/internal/mcp` module.
Created an `export_test.go` file within the `mcp` package to expose unexported handlers to the `mcp_test` package without polluting the production code.
Implemented comprehensive unit tests for `HandleListHosts`, `HandleListQuests`, `HandleListTomes`, `HandleQuestOutput`, `HandleWaitForQuest`, and `HandleCreateQuest`, verifying correct output JSON and handling of error paths such as missing context clients or invalid parameter formats.
The module coverage has been increased from ~16.2% to ~78.3%, and all tests have been repeatedly verified to prevent flakiness.

Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant