Skip to content

test(source/firestore): migrate integration tests to MCP endpoint - #4206

Open
DylanVolz wants to merge 3 commits into
googleapis:mainfrom
DylanVolz:chore/firestore-mcp-migration
Open

DylanVolz wants to merge 3 commits into
googleapis:mainfrom
DylanVolz:chore/firestore-mcp-migration

Conversation

@DylanVolz

Copy link
Copy Markdown

Description

Migrates the Firestore integration tests from the legacy /api endpoint to the MCP endpoint (/mcp), following #2922. The legacy REST test is kept, and both transports share setup and assertions.

  • Adds firestore_mcp_test.go: MCP tools/list for all 13 tools, the existing JSON-RPC error-path checks, and every tool invocation check over MCP.
  • Refactors the legacy file into shared setup (setupFirestoreTest) and a small REST/MCP transport; request bodies are now args maps.
  • Teardown is registered with t.Cleanup before seeding and uses a bounded context.WithoutCancel context; test documents are seeded in one BulkWriter batch and the client is closed on cleanup.

Testing: Ran both tests locally against the Firestore emulator with dummy credentials: tools/list and 100 subtests pass on both transports. analyzeQuery and the get/validate rules tools need real Firestore and the Firebase Rules API, so those are verified by the CI firestore job.

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure you have manually reviewed the entire diff before requesting a
    review
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

@DylanVolz
DylanVolz requested review from a team as code owners September 30, 2026 21:55
@google-cla

google-cla Bot commented Sep 30, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the Firestore integration tests to support both REST and MCP transports by introducing a firestoreTransport helper and a firestoreTestData struct. It also optimizes test data setup and cleanup using Firestore's BulkWriter and t.Cleanup, and adds a new test file firestore_mcp_test.go to validate MCP tool listings and invocations. The review feedback correctly identifies a logical gap in the invokeCase helper where tests could silently pass if a tool invocation unexpectedly succeeds when an error was expected, and provides a clear code suggestion to address this issue.

Comment thread tests/firestore/firestore_integration_test.go
@DylanVolz
DylanVolz force-pushed the chore/firestore-mcp-migration branch from c2d4071 to c8eb674 Compare October 16, 2026 20:34

This branch has not been deployed

No deployments
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.

2 participants