Skip to content

test: expand gRPC integration test depth for PR #3202#4658

Merged
ja8zyjits merged 3 commits into
mainfrom
issue-4618-grpc-test-coverage-v2
May 29, 2026
Merged

test: expand gRPC integration test depth for PR #3202#4658
ja8zyjits merged 3 commits into
mainfrom
issue-4618-grpc-test-coverage-v2

Conversation

@msureshkumar88

Copy link
Copy Markdown
Collaborator

Summary

Adds 7 integration tests covering previously uncovered code paths in gRPC service management, as identified in issue #4618 (follow-up to PR #3202).

Changes

Tests Added to tests/unit/mcpgateway/services/test_grpc_service.py:

  1. TestDeleteServiceChunkedBulkDelete::test_delete_service_chunked_bulk_delete - Verifies chunked deletion when >500 tools exist
  2. TestInvokeMethodMetadataForwarding::test_invoke_method_metadata_forwarded_to_endpoint - Confirms gRPC metadata forwarding
  3. TestInvokeMethodExceptionWrapping::test_invoke_method_runtime_error_wrapped_as_grpc_service_error - Validates exception wrapping
  4. TestInvokeMethodFinallyClose::test_invoke_method_finally_close_called_on_exception - Ensures finally block execution
  5. TestSyncToolsSchemaChange::test_sync_tools_schema_change_increments_tools_updated - Verifies schema change detection
  6. TestSyncToolsUnchanged::test_sync_tools_unchanged_does_not_increment_tools_updated - Confirms no-change path

Test Added to tests/unit/mcpgateway/services/test_tool_service.py:

  1. TestToolService::test_invoke_tool_grpc_dispatch_success - Validates gRPC dispatch in tool_service

Testing

All 7 tests pass. No production code changes (tests only).

Closes #4618

Add 7 tests covering previously uncovered code paths in gRPC service:

- test_delete_service_chunked_bulk_delete: Verify chunked deletion of >500 tools
- test_invoke_method_metadata_forwarded_to_endpoint: Confirm metadata forwarding
- test_invoke_method_runtime_error_wrapped_as_grpc_service_error: Exception wrapping
- test_invoke_method_finally_close_called_on_exception: Finally block execution
- test_sync_tools_schema_change_increments_tools_updated: Schema change detection
- test_sync_tools_unchanged_does_not_increment_tools_updated: No-change path
- test_invoke_tool_grpc_dispatch_success: gRPC dispatch in tool_service

All tests pass individually. No production code changes.

Closes #4618

Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
@msureshkumar88 msureshkumar88 added testing Testing (unit, e2e, manual, automated, etc) mcp-protocol Alignment with MCP protocol or specification COULD P3: Nice-to-have features with minimal impact if left out; included if time permits labels May 7, 2026
@msureshkumar88 msureshkumar88 self-assigned this May 7, 2026
Removed trailing whitespace on line 2709 that was causing pre-commit
hook to fail.

Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
"""Test that changing input_schema increments tools_updated counter."""
# First-Party
from mcpgateway.db import Tool as DbTool
from mcpgateway.services.grpc_service import GrpcService

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Move all the imports to top of file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@prakhar-singh1928 prakhar-singh1928 self-assigned this May 28, 2026
Closes #4658

Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>

@prakhar-singh1928 prakhar-singh1928 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@ja8zyjits ja8zyjits merged commit 88eeaa5 into main May 29, 2026
4 checks passed
@ja8zyjits ja8zyjits deleted the issue-4618-grpc-test-coverage-v2 branch May 29, 2026 10:53
@ja8zyjits ja8zyjits self-assigned this May 29, 2026
@cafalchio cafalchio mentioned this pull request Jun 10, 2026
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

COULD P3: Nice-to-have features with minimal impact if left out; included if time permits mcp-protocol Alignment with MCP protocol or specification testing Testing (unit, e2e, manual, automated, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TESTING][GRPC]: Expand integration test depth (chunked deletes, metadata, exception wrap)

3 participants