Skip to content

test(source/alloydbomni): create MCP integration tests#2964

Open
anubhav756 wants to merge 6 commits intoanubhav-parityfrom
anubhav-mcp-alloydbomni
Open

test(source/alloydbomni): create MCP integration tests#2964
anubhav756 wants to merge 6 commits intoanubhav-parityfrom
anubhav-mcp-alloydbomni

Conversation

@anubhav756
Copy link
Copy Markdown
Contributor

@anubhav756 anubhav756 commented Apr 6, 2026

This PR adds the mapped integration tests for AlloyDB Omni tools using the native MCP harness.

@anubhav756 anubhav756 self-assigned this Apr 6, 2026
@anubhav756 anubhav756 requested review from a team as code owners April 6, 2026 13:41
Copy link
Copy Markdown
Contributor

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

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 introduces a new integration test suite for AlloyDB Omni and a comprehensive set of reusable test helpers for MCP database tools, covering views, schemas, active queries, triggers, and more. The feedback focuses on improving test efficiency and maintainability by suggesting a reduction in test timeouts, the use of proper context propagation instead of context.Background(), and the refactoring of hardcoded SQL filter strings into constants.

// InitPostgresConnectionPool initializes a connection pool for Postgres.
func InitPostgresConnectionPool(host, port, user, pass, dbname string) (*pgxpool.Pool, error) {
url := buildPostgresURL(host, port, user, pass, dbname)
pool, err := pgxpool.New(context.Background(), url.String())
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.

medium

Using context.Background() in tests is generally discouraged. Consider passing the test context or a derived context to ensure proper cancellation and resource cleanup.


// cleanupOldSchemas cleans up schemas that were created more than 1 hour ago
func cleanupOldSchemas(t *testing.T, ctx context.Context, pool *pgxpool.Pool) {
rows, err := pool.Query(ctx, "SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE 'test_proc_%'")
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.

medium

The query uses a hardcoded string literal 'test_proc_%' for filtering. Consider using a constant or a more robust way to identify test schemas to avoid potential collisions or maintenance issues.

@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch 3 times, most recently from 01d4bfb to 2d7e90b Compare April 6, 2026 14:13
@anubhav756 anubhav756 requested review from a team as code owners April 6, 2026 15:56
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch 2 times, most recently from 1c411a8 to 77eb420 Compare April 6, 2026 16:43
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbainl branch from 4fe514a to 075e596 Compare April 7, 2026 07:25
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 77eb420 to 97ce3c1 Compare April 7, 2026 07:26
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbainl branch from 075e596 to af9312a Compare April 7, 2026 07:32
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 97ce3c1 to bcecb75 Compare April 7, 2026 07:33
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbainl branch from af9312a to 79969dc Compare April 7, 2026 10:01
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch 2 times, most recently from 131d237 to fef27e4 Compare April 7, 2026 14:19
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbainl branch from 79969dc to e284d4f Compare April 7, 2026 14:28
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch 2 times, most recently from 6d21e9c to 41b03ac Compare April 7, 2026 20:42
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 816552c to 62dfc08 Compare April 8, 2026 13:10
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch from 2be51dc to 5561185 Compare April 8, 2026 14:22
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 62dfc08 to ddb001a Compare April 8, 2026 14:23
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch from 5561185 to 480b04b Compare April 8, 2026 15:41
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from ddb001a to 6839d7d Compare April 8, 2026 15:42
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch from 480b04b to 6cc7509 Compare April 8, 2026 15:53
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 6839d7d to 483ed1d Compare April 8, 2026 15:54
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch from e120bc5 to e74fd80 Compare April 8, 2026 16:27
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 483ed1d to 8be4808 Compare April 8, 2026 18:27
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch from e74fd80 to 3a4c79b Compare April 8, 2026 18:41
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch 2 times, most recently from 1affb35 to 5cf000b Compare April 8, 2026 18:59
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch 2 times, most recently from 29a4b31 to 64f7997 Compare April 8, 2026 19:33
@anubhav756 anubhav756 force-pushed the anubhav-mcp-alloydbomni branch from 5cf000b to 940ed19 Compare April 8, 2026 19:34
@anubhav756 anubhav756 force-pushed the anubhav-mcp-cloudsqlpg branch 9 times, most recently from aad6cd9 to 9ecd5c2 Compare April 9, 2026 20:53
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