Refactor full_app_e2e.py for real gRPC E2E test#152
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit refactors
tsercom/full_app_e2etest.pyto perform a true end-to-end validation using a real gRPC channel, replacing previous mocks.Key changes include:
E2ETestServiceServicerfor a test-specific Echo gRPC service.GenericClientRuntimenow hosts this servicer usingGrpcServicePublisherand advertises it via mDNS usingInstancePublisher.GenericServerRuntimediscovers the service usingDiscoveryHostandServiceConnector, then makes an RPC call to the Echo method.GenericServerRuntimetotest_anomoly_serviceis handled via anasyncio.Queue.GenericServerRuntimenow propagate to be caught by runtime error handlers, simplifying test logic.E2ETestServiceServicer.Echomethod is asynchronous.test_anomoly_serviceand 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.