Open
Conversation
Adds a new end-to-end test (`test_full_e2e_with_discovery_and_grpc_stream`) to `tsercom/full_app_e2etest.py`. This test validates the full client-advertises, server-discovers architecture (specifically, server-advertises, client-discovers in this implementation) using a real, bidirectional gRPC stream. Key features tested: - Service advertisement by a "Data Source" runtime (`TestDataSourceRuntime`) using `InstancePublisher`. - Service discovery by a "Data Aggregator" runtime (`TestDataAggregatorRuntime`) using `DiscoveryHost` and `ServiceConnector`, with a `FakeMdnsListener` for deterministic testing. - Orchestration of runtimes via `RuntimeManager` in an out-of-process configuration. - A new bidirectional gRPC stream RPC (`ExchangeData`) on `E2ETestService`. - `CallerId` handshaking at the beginning of the stream. - Bidirectional data transfer (client sends `TensorChunk`, server responds with `TensorChunk`) through the gRPC stream. - Assertions for correct data reception on both ends. Proto changes: - Added `ExchangeData` RPC to `e2e_test_service.proto`. - Defined `E2EStreamRequest` (with `CallerId` and `TensorChunk` payload). - Defined `E2EStreamResponse` (with `ack_message` and `TensorChunk` payload) to support bidirectional data flow. - Corrected proto imports to use relative paths (e.g., `import "caller_id.proto"`) for compatibility with the existing `generate_protos.py` script. Test implementation details: - New runtime classes `TestDataSourceRuntime` and `TestDataAggregatorRuntime` were created within the test file. - `E2ETestServicer` was updated to implement the `ExchangeData` RPC. - `AggregatorStreamHandler` helper class manages the client-side stream logic. - `asyncio.Queue` is used for communication and synchronization between the test function and the runtime components. Minor fixes: - Addressed an `AttributeError` in the existing `test_full_app_with_grpc_transport` by ensuring consistent use of server ID attributes in `E2eTestServicer`. - Suppressed PytestCollectionWarnings for new runtime classes by adding `__test__ = False`. - Manually patched a generated protobuf Python file (`e2e_test_service_pb2.py`) to fix an import error related to `tensor_pb2` because the original `generate_protos.py` script does not fully handle its import linkage. This is a temporary workaround for the test to pass under current constraints. - Addressed a `ModuleNotFoundError` for `tsercom.runtime.runtime_identity` by removing its usage and relying on direct UUID strings, as the file was missing from the provided codebase.
Adds a new end-to-end test (`test_full_e2e_with_discovery_and_grpc_stream`) to `tsercom/full_app_e2etest.py`. This test validates the full client-advertises, server-discovers architecture (specifically, server-advertises, client-discovers in this implementation) using a real, bidirectional gRPC stream. Key features tested: - Service advertisement by a "Data Source" runtime (`TestDataSourceRuntime`) using `InstancePublisher`. - Service discovery by a "Data Aggregator" runtime (`TestDataAggregatorRuntime`) using `DiscoveryHost` and `ServiceConnector`, with a `FakeMdnsListener` for deterministic testing. - Orchestration of runtimes via `RuntimeManager` in an out-of-process configuration. - A new bidirectional gRPC stream RPC (`ExchangeData`) on `E2ETestService`. - `CallerId` handshaking at the beginning of the stream. - Bidirectional data transfer (client sends `TensorChunk`, server responds with `TensorChunk`) through the gRPC stream. - Assertions for correct data reception on both ends. Proto changes: - Added `ExchangeData` RPC to `e2e_test_service.proto`. - Defined `E2EStreamRequest` (with `CallerId` and `TensorChunk` payload). - Defined `E2EStreamResponse` (with `ack_message` and `TensorChunk` payload) to support bidirectional data flow. - Corrected proto imports to use relative paths (e.g., `import "caller_id.proto"`) for compatibility with the existing `generate_protos.py` script. Test implementation details: - New runtime classes `TestDataSourceRuntime` and `TestDataAggregatorRuntime` were created within the test file. - `E2ETestServicer` was updated to implement the `ExchangeData` RPC. - `AggregatorStreamHandler` helper class manages the client-side stream logic. - `asyncio.Queue` is used for communication and synchronization between the test function and the runtime components. Minor fixes & Workarounds: - Addressed an `AttributeError` in the existing `test_full_app_with_grpc_transport` by ensuring consistent use of server ID attributes in `E2eTestServicer` and reverting response message formats to their original state for compatibility. - Suppressed PytestCollectionWarnings for new runtime classes by adding `__test__ = False`. - Manually patched the generated `tsercom/test/proto/generated/v1_73/e2e_test_service_pb2.py` to fix an import error (`ModuleNotFoundError: No module named 'tensor_pb2'`). This was necessary because the original `scripts/generate_protos.py` script does not correctly handle the import generation for `tensor_pb2` when used as a dependency in `e2e_test_service.proto` with relative proto imports. This is a temporary workaround to allow tests to pass under the constraint that `generate_protos.py` should not be modified. - Addressed a `ModuleNotFoundError` for `tsercom.runtime.runtime_identity` by removing its usage and relying on direct UUID strings, as the file was missing from the provided codebase.
Implements the structure for a new end-to-end test in `tsercom/full_app_e2etest.py` named `test_full_e2e_with_discovery_and_grpc_stream`. This test aims to validate the full client-advertises, server-discovers architecture using a real, bidirectional gRPC stream, CallerId handshaking, and data transfer between two new runtime classes, `TestDataSourceRuntime` and `TestDataAggregatorRuntime`, orchestrated by `RuntimeManager` in out-of-process mode. Key changes include: - Modifications to `tsercom/test/proto/e2e_test_service.proto` to add a new `ExchangeData` RPC with `E2EStreamRequest` and `E2EStreamResponse` messages for handling handshake and data streaming. - Adjustments to `scripts/generate_protos.py` to attempt to correctly generate code for the updated test proto, though this encountered persistent "symbol not defined" errors from `protoc`. - Implementation of `E2ETestServicer.ExchangeData` method to handle the server-side stream logic. - Creation of `TestDataSourceRuntime` which publishes the service and `TestDataAggregatorRuntime` which discovers and connects to it, using a helper `AggregatorStreamHandler` for client-side stream management. - Addition of `TestDataSourceRuntimeInitializer` and `TestDataAggregatorRuntimeInitializer`. - The new test function `test_full_e2e_with_discovery_and_grpc_stream` sets up these components, uses a `FakeMdnsListener`, and starts runtimes out-of-process. Known Issues & Limitations: - Protobuf Generation: The `scripts/generate_protos.py` script consistently failed to compile the updated `e2e_test_service.proto` correctly, resulting in "symbol not defined" errors from `protoc`. This prevented the new message types (e.g., `E2EStreamRequest`) from being generated, causing `ImportError` when trying to run tests. The root cause of this generation failure could not be resolved. - Out-of-Process (OOP) Test Validation: The requirement for OOP testing with `RuntimeManager` poses challenges for triggering actions and asserting state across processes from the main test function. The current test implementation includes structural placeholders but does not fully validate bidirectional data flow due to these limitations. Further work on IPC mechanisms or runtime control interfaces would be needed for complete OOP validation. Due to the protobuf generation failures, the new test currently fails at the collection stage.
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.
Adds a new end-to-end test (
test_full_e2e_with_discovery_and_grpc_stream) totsercom/full_app_e2etest.py. This test validates the full client-advertises, server-discovers architecture (specifically, server-advertises, client-discovers in this implementation) using a real, bidirectional gRPC stream.Key features tested:
TestDataSourceRuntime) usingInstancePublisher.TestDataAggregatorRuntime) usingDiscoveryHostandServiceConnector, with aFakeMdnsListenerfor deterministic testing.RuntimeManagerin an out-of-process configuration.ExchangeData) onE2ETestService.CallerIdhandshaking at the beginning of the stream.TensorChunk, server responds withTensorChunk) through the gRPC stream.Proto changes:
ExchangeDataRPC toe2e_test_service.proto.E2EStreamRequest(withCallerIdandTensorChunkpayload).E2EStreamResponse(withack_messageandTensorChunkpayload) to support bidirectional data flow.import "caller_id.proto") for compatibility with the existinggenerate_protos.pyscript.Test implementation details:
TestDataSourceRuntimeandTestDataAggregatorRuntimewere created within the test file.E2ETestServicerwas updated to implement theExchangeDataRPC.AggregatorStreamHandlerhelper class manages the client-side stream logic.asyncio.Queueis used for communication and synchronization between the test function and the runtime components.Minor fixes:
AttributeErrorin the existingtest_full_app_with_grpc_transportby ensuring consistent use of server ID attributes inE2eTestServicer.__test__ = False.e2e_test_service_pb2.py) to fix an import error related totensor_pb2because the originalgenerate_protos.pyscript does not fully handle its import linkage. This is a temporary workaround for the test to pass under current constraints.ModuleNotFoundErrorfortsercom.runtime.runtime_identityby removing its usage and relying on direct UUID strings, as the file was missing from the provided codebase.