test(source/cloud-sql-mysql): create MCP integration tests#2922
test(source/cloud-sql-mysql): create MCP integration tests#2922dishaprakash wants to merge 27 commits intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive integration tests for the Model Context Protocol (MCP) across various data sources, including AlloyDB, Cloud SQL MySQL, and HTTP. It also adds modular helper functions in tests/mcp_tool.go to facilitate standardized MCP tool testing. Several issues were identified in the review: a critical flaw in the Cloud SQL MySQL instance creation test where mocking http.DefaultClient fails to affect the separate toolbox process, and multiple violations of the repository style guide regarding tool naming conventions (snake_case and product name exclusion). Additionally, the use of time.Sleep in MySQL tests was flagged as a potential source of flakiness, and some error assertions were noted as being too weak.
tests/cloudsqlmysql/cloud_sql_mysql_create_instance_mcp_integration_test.go
Show resolved
Hide resolved
db1827c to
7c651a9
Compare
69bb59b to
d81edf8
Compare
94d7fce to
e3fa5a6
Compare
d81edf8 to
4c21e3f
Compare
0019b41 to
0a48e1c
Compare
16be479 to
f643196
Compare
082b05d to
225d74f
Compare
f643196 to
2e6e044
Compare
2e6e044 to
5a9f6bd
Compare
e698ea1 to
072f36b
Compare
5a9f6bd to
d2bdddd
Compare
0fb9a98 to
6403946
Compare
Description
This PR migrates the Cloud SQL MySQL integration tests to use the /mcp endpoint on the MCP Toolbox Server.
Key Changes
tests/mcp_tool.go:cloud_sql_mysql_mcp_test.go: Migrated legacy/apitests to/mcpcloud_sql_mysql_create_instance_mcp_test.go: Migrated create-instance tests to validate MCP JSON-RPC handling.tests/options.go: Added functional options for the various MySQL test fixtures to provide an MCP tests specific pathtests/tool.go: Used the above mentioned options to allow calling MCP Endpoints in the test fixtures of MySQL