Skip to content

test: expand E2E integration test suite for cross-SDK parity - #83

Merged
stenalpjolly merged 6 commits into
googleapis:mainfrom
stenalpjolly:stenalpjolly_integration-test-parity
Sep 9, 2026
Merged

stenalpjolly merged 6 commits into
googleapis:mainfrom
stenalpjolly:stenalpjolly_integration-test-parity

Conversation

@stenalpjolly

@stenalpjolly stenalpjolly commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expands the Java SDK E2E integration test suite to achieve full functional parity with the Go, JavaScript/TypeScript, and Python SDKs. Adds comprehensive error handling, argument type and presence validations, schema pruning assertions, optional/default parameter tests, structured Map data handling, protocol version negotiations, and custom client header verifications. Adds a convenience text() method to ToolResult. Consolidates all E2E integration tests into a single test file (McpToolboxClientE2ETest) to optimize CI execution time by booting the live server container only once.

Expectation & Implementation

  • ToolResult Convenience Method: Adds public String text() to ToolResult for easy access to concatenated text content from result blocks.
  • Consolidated Single-Process Server Lifecycle: Unifies all E2E tests under McpToolboxClientE2ETest managed by ToolboxE2ESetup, eliminating redundant container boot cycles and saving 20-30s in CI.
  • Robust Server Teardown: Updates ToolboxE2ESetup to use destroyForcibly() if the subprocess fails to terminate gracefully within the timeout.
  • External Server Alerting: Emits a prominent warning banner when TOOLBOX_SERVER_URL is set, reminding contributors of manifest revision requirements.
  • Tool & Toolset Loading Errors: Validates negative paths when loading non-existent toolsets and tools, asserting appropriate exception propagation.
  • Argument & Type Validations: Verifies missing required parameters, type mismatches (e.g. passing integer for string or string for map), null required parameters, and null optional parameters.
  • Bound Parameter Pruning in Live E2E: Confirms that parameters bound via tool.bindParam(...) are pruned from the exposed tool definition schema.
  • Authentication Resilience: Tests missing tokens on authenticated tools, invalid tokens, and failing token supplier futures without broad exception catching.
  • Complex & Structured Payloads: Tests search-rows (optional string and integer parameters with omission and explicit values, strict "null" assertion for non-matching data) and process-data (nested Map<String, Object> payloads with structural Jackson JSON parsing handling both array and object payloads).
  • Protocol Versions & Headers: Validates client creation with custom headers and parameterizes protocol versions (VERSION_2024_11_05, VERSION_2025_03_26, VERSION_2025_06_18, VERSION_2025_11_25) against the live MCP Toolbox server.

Test cases

  • McpToolboxClientE2ETest:
    • testLoadToolsetSpecific
    • testLoadToolsetDefault
    • testLoadNonExistentToolset
    • testLoadNonExistentTool
    • testRunTool
    • testRunToolMissingRequiredParams
    • testRunToolWrongParamType
    • testRunToolWithNullOptionalParams
    • testRunToolWithNullRequiredParams
    • testBindParams
    • testBindParamsCallable
    • testBoundParamPruningSchema
    • testRunToolAuth
    • testRunToolWrongAuth
    • testRunToolAuthWithoutProvidingAuth
    • testRunToolParamAuth
    • testRunToolParamAuthNoField
    • testRunToolWithFailingTokenSupplier
    • testSearchRowsDefinitionSchema
    • testSearchRowsOmittingOptionals
    • testSearchRowsWithAllParamsProvided
    • testSearchRowsMissingRequiredParam
    • testSearchRowsNonMatchingData
    • testProcessDataDefinitionSchema
    • testProcessDataWithMapParams
    • testProcessDataOmittingOptionalMap
    • testProcessDataWithWrongMapValueType
    • testClientWithCustomHeaders
    • testClientWithExplicitProtocolVersions (Parameterized across 4 MCP protocol versions)

Acceptance criteria

  • All 130 local unit tests pass with 100% check coverage.
  • Code strictly formatted according to Google Java Format standard.
  • All E2E tests pass cleanly against the live MCP Toolbox server in a single test pass.
  • Presubmit CI triggers (core-java-sdk-pr in Cloud Build and GitHub Actions workflows) pass cleanly.

Breaking changes

None.

- Add missing toolset and tool loading negative error tests
- Add argument validation tests for missing and wrong parameter types
- Add bound parameter schema pruning assertion in live integration tests
- Add auth failure and missing token negative test cases
- Add complex data types suite covering optional search-rows and process-data
- Add protocol version selection and client headers E2E tests
- Add TOOLBOX_SERVER_URL environment support to ToolboxE2ESetup
@stenalpjolly
stenalpjolly requested a review from a team as a code owner August 12, 2026 08:27

@anubhav756 anubhav756 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.

Tests are incorrect, they seem to be passing wrong param values and on failure they seem to be swallowing the error and passing anyway.

Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
@stenalpjolly
stenalpjolly force-pushed the stenalpjolly_integration-test-parity branch from 16bb008 to ec12882 Compare September 3, 2026 09:39

@anubhav756 anubhav756 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.

The PR summary states:

Adds test cases for missing tokens on authenticated tools, invalid tokens, unauthenticated tools receiving tokens, and failing token supplier futures.

Is that really implemented in this PR?

Comment thread src/test/java/com/google/cloud/mcp/e2e/ToolboxE2ESetup.java
Comment thread src/test/java/com/google/cloud/mcp/e2e/ToolboxE2ESetup.java
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxClientE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxClientE2ETest.java
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
- Correct process-data parameter payload to use execution_context, user_scores, and feature_flags instead of fictional input_data
- Remove exception-swallowing try-catch blocks in testProcessDataWithMapParams and testRunToolAuthWithoutProvidingAuth
- Implement missing testProcessDataOmittingOptionalMap test method
- Add comprehensive parameter schema assertions in testProcessDataDefinitionSchema
- Parse JSON structurally in process-data tests to eliminate non-deterministic map ordering flakes
- Narrow exception expectations from Exception.class to CompletionException with specific cause message checks
- Consolidate duplicated getTextContent helper into ToolboxE2ESetup for DRY compliance
- Align testSearchRowsNonMatchingData with expected empty or 'null' return on argument mismatch
- Support TOOLBOX_AUTH_TOKEN_1 and TOOLBOX_AUTH_TOKEN_2 fallback environment variables in ToolboxE2ESetup

TAG=agy
CONV=f9ec8a85-66e3-479e-a944-3b621f8bcd18
@stenalpjolly
stenalpjolly force-pushed the stenalpjolly_integration-test-parity branch from ec12882 to e6826b9 Compare September 3, 2026 12:07
…er precedence

- Align testLoadNonExistentToolset cause check with server error message
- Assert parameter immutability on original tool definition after bindParam
- Check parameter types ('string', 'integer') in search-rows definition schema
- Use LinkedHashMap for map parameters to ensure deterministic key ordering
- Ensure TOOLBOX_SERVER_URL takes precedence when configured in test setup

TAG=agy
CONV=f9ec8a85-66e3-479e-a944-3b621f8bcd18
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxProtocolE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/ToolboxE2ESetup.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxComplexTypesE2ETest.java Outdated
Comment thread src/test/java/com/google/cloud/mcp/e2e/ToolboxE2ESetup.java
Comment thread src/test/java/com/google/cloud/mcp/e2e/McpToolboxClientE2ETest.java Outdated
- Consolidate all E2E integration tests into McpToolboxClientE2ETest
- Add text() convenience method to ToolResult
- Add tests for null parameters, type mismatches, and invalid map types
- Use Jackson structural JSON node parsing in process-data assertions
- Use destroyForcibly() for server process teardown
- Parameterize protocol version test across supported versions

TAG=agy
CONV=f9ec8a85-66e3-479e-a944-3b621f8bcd18
…atching output

- Unwrap PostgreSQL jsonb_build_object column if present in Jackson parsing
- Allow both empty string and 'null' for non-matching search-rows output

TAG=agy
CONV=f9ec8a85-66e3-479e-a944-3b621f8bcd18
@stenalpjolly
stenalpjolly merged commit bdb5f12 into googleapis:main Sep 9, 2026
11 checks passed
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