Skip to content

Comments

Refactor full_app_e2e.py for real gRPC E2E test#152

Open
rwkeane wants to merge 2 commits intomainfrom
refactor/grpc-e2e-test-4
Open

Refactor full_app_e2e.py for real gRPC E2E test#152
rwkeane wants to merge 2 commits intomainfrom
refactor/grpc-e2e-test-4

Conversation

@rwkeane
Copy link
Owner

@rwkeane rwkeane commented Jun 17, 2025

This commit refactors tsercom/full_app_e2etest.py to perform a true end-to-end validation using a real gRPC channel, replacing previous mocks.

Key changes include:

  • Implemented E2ETestServiceServicer for a test-specific Echo gRPC service.
  • GenericClientRuntime now hosts this servicer using GrpcServicePublisher and advertises it via mDNS using InstancePublisher.
  • GenericServerRuntime discovers the service using DiscoveryHost and ServiceConnector, then makes an RPC call to the Echo method.
  • Communication of the RPC result from GenericServerRuntime to test_anomoly_service is handled via an asyncio.Queue.
  • Error handling refined: RPC exceptions in GenericServerRuntime now propagate to be caught by runtime error handlers, simplifying test logic.
  • Unnecessary "what" or meta-comments removed to improve code clarity.
  • Ensured E2ETestServiceServicer.Echo method is asynchronous.
  • Addressed all MyPy typing issues, including those related to dynamic protobuf imports by using direct paths to versioned generated files.
  • All static analysis tools (black, ruff, mypy, pylint) pass.
  • The refactored test_anomoly_service and the full test suite pass consistently.

This work incorporates feedback on comment quality and error handling mechanisms, resulting in a cleaner and more robust E2E test.

This commit refactors `tsercom/full_app_e2etest.py` to perform a true end-to-end validation using a real gRPC channel, replacing previous mocks.

Key changes include:
- Implemented `E2ETestServiceServicer` for a test-specific Echo gRPC service.
- `GenericClientRuntime` now hosts this servicer using `GrpcServicePublisher` and advertises it via mDNS using `InstancePublisher`.
- `GenericServerRuntime` discovers the service using `DiscoveryHost` and `ServiceConnector`, then makes an RPC call to the Echo method.
- Communication of the RPC result from `GenericServerRuntime` to `test_anomoly_service` is handled via an `asyncio.Queue`.
- Error handling refined: RPC exceptions in `GenericServerRuntime` now propagate to be caught by runtime error handlers, simplifying test logic.
- Unnecessary "what" or meta-comments removed to improve code clarity.
- Ensured `E2ETestServiceServicer.Echo` method is asynchronous.
- Addressed all MyPy typing issues, including those related to dynamic protobuf imports by using direct paths to versioned generated files.
- All static analysis tools (black, ruff, mypy, pylint) pass.
- The refactored `test_anomoly_service` and the full test suite pass consistently.

This work incorporates feedback on comment quality and error handling mechanisms, resulting in a cleaner and more robust E2E test.
This commit refactors `tsercom/full_app_e2etest.py` to perform a true end-to-end validation using a real gRPC channel, replacing previous mocks. This version incorporates your feedback on protobuf import conventions, comment quality, and error handling.

Key changes:
- Implemented `E2ETestServiceServicer` for a test-specific Echo gRPC service.
- `GenericClientRuntime` now hosts this servicer using `GrpcServicePublisher` and advertises it via mDNS using `InstancePublisher`.
- `GenericServerRuntime` discovers the service using `DiscoveryHost` and `ServiceConnector`, then makes an RPC call to the Echo method.
- Communication of the RPC result from `GenericServerRuntime` to `test_anomoly_service` is handled via an `asyncio.Queue`.
- Error handling refined: RPC exceptions in `GenericServerRuntime` now propagate to be caught by runtime error handlers, simplifying test logic.
- Unnecessary "what" or meta-comments removed to improve code clarity.
- Ensured `E2ETestServiceServicer.Echo` method is asynchronous.
- Protobuf imports now correctly use `from tsercom.test.proto import ...` by making `tsercom.test.proto/__init__.py` more MyPy-friendly, re-exporting the generated modules. This avoids `# type: ignore` for these specific imports in the test file.
- Addressed all MyPy typing issues. All static analysis tools (black, ruff, mypy, pylint) pass.
- The refactored `test_anomoly_service` and the full test suite pass consistently.
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