Open
Conversation
This commit introduces a new end-to-end test (`test_full_app_with_grpc_transport`) to `tsercom/full_app_e2etest.py`. This test validates the full application flow using a real gRPC communication channel and a fake mDNS listener. Key changes include: - Implementation of `E2eTestServicer` in `tsercom/test/e2e_test_servicer.py` to handle gRPC calls for the `E2ETestService` defined in the test protos. - Modifications to `GenericServerRuntime` to create and store a gRPC stub (`_e2e_test_stub`) upon connection, allowing it to act as a gRPC client. - Modifications to `GenericClientRuntime` to add the `E2eTestServicer` to its gRPC server instance during startup, allowing it to host the gRPC service. - Adjustments to `GenericServerRuntimeInitializer` and `GenericClientRuntimeInitializer` to correctly configure `discovery_service_type` and `advertising_service_type` respectively. This ensures that the `FakeMdnsListener` and mDNS publishing work correctly for both the existing anomaly test and the new gRPC E2E test. - The `clear_loop_fixture` was updated to also clear any pending items from the `E2eTestServicer`'s shared data queue. I performed work to pass static analysis (black, ruff, mypy, pylint): - Added `type: ignore` comments for issues related to generated gRPC files, untyped base classes, and specific MyPy errors. - Added pylint disable comments for gRPC conventional method names (e.g., `Echo`). - Corrected type hints where possible. Known Issues and Stuck Points: - A persistent MyPy error `[unused-coroutine]` occurred on the line `await asyncio.to_thread(self.__mdns_publisher.unpublish)` in `GenericClientRuntime.stop()`. Auto-formatters (black/ruff) would reposition the `type: ignore[unused-coroutine]` comment, leading to an "unused ignore" error, which then re-exposed the original `unused-coroutine` error. The interaction between formatters and MyPy made this difficult to resolve. - MyPy reported `[attr-defined]` for internal attributes like `self.__grpc_publisher._GrpcServicePublisher__port` and `self.__mdns_publisher._port` used for logging/testing; these were suppressed with `type: ignore[attr-defined]`. - MyPy reported `[type-arg]` for `RuntimeManager` instantiations, suppressed with `type: ignore`. - Pylint score is still low, mainly due to unavoidable import errors for generated protobuf files and conventional `context` arguments in gRPC methods. Further work will be needed to fully resolve the MyPy Cylon and improve the Pylint score. The primary goal of adding the gRPC E2E test structure and functionality is met.
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 introduces a new end-to-end test (
test_full_app_with_grpc_transport) totsercom/full_app_e2etest.py. This test validates the full application flow using a real gRPC communication channel and a fake mDNS listener.Key changes include:
E2eTestServicerintsercom/test/e2e_test_servicer.pyto handle gRPC calls for theE2ETestServicedefined in the test protos.GenericServerRuntimeto create and store a gRPC stub (_e2e_test_stub) upon connection, allowing it to act as a gRPC client.GenericClientRuntimeto add theE2eTestServicerto its gRPC server instance during startup, allowing it to host the gRPC service.GenericServerRuntimeInitializerandGenericClientRuntimeInitializerto correctly configurediscovery_service_typeandadvertising_service_typerespectively. This ensures that theFakeMdnsListenerand mDNS publishing work correctly for both the existing anomaly test and the new gRPC E2E test.clear_loop_fixturewas updated to also clear any pending items from theE2eTestServicer's shared data queue.I performed work to pass static analysis (black, ruff, mypy, pylint):
type: ignorecomments for issues related to generated gRPC files, untyped base classes, and specific MyPy errors.Echo).Known Issues and Stuck Points:
[unused-coroutine]occurred on the lineawait asyncio.to_thread(self.__mdns_publisher.unpublish)inGenericClientRuntime.stop(). Auto-formatters (black/ruff) would reposition thetype: ignore[unused-coroutine]comment, leading to an "unused ignore" error, which then re-exposed the originalunused-coroutineerror. The interaction between formatters and MyPy made this difficult to resolve.[attr-defined]for internal attributes likeself.__grpc_publisher._GrpcServicePublisher__portandself.__mdns_publisher._portused for logging/testing; these were suppressed withtype: ignore[attr-defined].[type-arg]forRuntimeManagerinstantiations, suppressed withtype: ignore.contextarguments in gRPC methods.Further work will be needed to fully resolve the MyPy Cylon and improve the Pylint score. The primary goal of adding the gRPC E2E test structure and functionality is met.