Repository navigation
Conversation
|
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. |
There was a problem hiding this comment.
Code Review
This pull request refactors the Neo4j integration tests to run against an ephemeral container using testcontainers-go and introduces a new test suite for testing the Neo4j Model Context Protocol (MCP) server. It consolidates the test cases into a shared helper to ensure both REST and MCP interfaces are tested consistently. The feedback suggests improving the REST test execution by using http.NewRequestWithContext instead of http.Post to ensure proper context and timeout propagation.
|
/gcbrun |
b33edc8 to
1cd2e82
Compare
Description
This PR migrates the Neo4j integration tests to use the /mcp endpoint on the MCP Toolbox Server, and adds a testcontainer fallback so the suite can run locally with Docker only.
Key Changes
neo4j_mcp_test.go: Migrated legacy/apitests to/mcpTestNeo4jMCPListToolsvalidates the fulltools/listmanifest for the six Neo4j tools configured in the test (neo4j-cypher,neo4j-execute-cypherand its read-only variant, and threeneo4j-schematools).TestNeo4jMCPCallToolruns the same nine invocation cases as the legacy test over MCP JSON-RPC: simple and ad-hoc cypher,dry_runquery plans, read-only enforcement, and schema extraction on an empty and a populated database (constraints, indexes, relationships).dry_run, and writes through the read-only tool with and withoutdry_run) are markedwantErrand must come back as an MCP error result (isError), not just contain error text.t.Cleanupfor server andcmd.Closecleanup.neo4j_integration_test.go: Added a container fallback and extracted shared helpers (no behavior change to the legacy test's assertions):setupNeo4jInstancestarts an ephemeralneo4j:5.26container with the APOC plugin (required by the schema tool) whenNEO4J_URIis unset, and restores the package-level connection variables on cleanup so each test gets its own container. CI setsNEO4J_URI, so it keeps using its existing instance.getNeo4jToolsConfigbuilds the shared tools file; the legacy test still appends the semantic search config.getNeo4jInvokeTestCasesholds the shared invocation cases (toolName+args map[string]any), replacing the inlinerequestBodyJSON strings and the unusedwantStatus/wantErrorSubstringfields.Semantic search stays in the legacy test only, since it requires a Gemini
API_KEY. No shared test helpers (tests/tool.go,tests/mcp_tool.go,tests/option.go) are modified.Verified locally against the
neo4j:5.26testcontainer:go test -count=1 -v -run TestNeo4jMCP ./tests/neo4j/passes, and the legacy test's manifest and invoke subtests pass (its semantic search subtests need a realAPI_KEY, which CI provides).PR Checklist
CONTRIBUTING.md
bug/issue
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
review
!if this involve a breaking change🛠️ Fixes #<issue_number_goes_here>