Repository navigation
test: add comprehensive tests for ProtoUtils To/FromProto conversions - #1205
Open
zh-hanlabs wants to merge 1 commit into
Open
zh-hanlabs wants to merge 1 commit into
zh-hanlabs wants to merge 1 commit into
Conversation
Add a ProtoUtilsTest class complementing ToProtoTest, covering: - the streaming/oneof conversions (streamResponse, taskOrMessage, taskOrMessageStream) for Task, Message, TaskStatusUpdateEvent and TaskArtifactUpdateEvent, mirroring the Python SDK's test_proto_utils.py TestToStreamResponse cases - round-trip conversions for the request/result wrappers (get task, cancel task, subscribe, send message, push notification config params/results, list tasks params/results) and AgentCard/Task - FromProto validation and normalization behaviors: empty message id raising InvalidParamsError, and empty tenant/next-page-token being normalized from the proto empty string to null Fixes a2aproject#304
This branch has not been deployed
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.
Fixes #304
What
Adds a
ProtoUtilsTestclass complementing the existingToProtoTest, with additional test cases forProtoUtils.ToProtoandProtoUtils.FromProto, modeled on the corresponding tests in the Python SDK referenced in the issue.Coverage added:
TestToStreamResponsecases):streamResponse,taskOrMessageandtaskOrMessageStreamwithTask,Message,TaskStatusUpdateEventandTaskArtifactUpdateEvent, each verified on the proto shape and converted back viaFromProto.streamingEventKind/FromProto.task/FromProto.message.ListTasksParams,ListTasksResultandAgentCard/Task(with artifacts, history, timestamps and metadata).FromProto.messagerejects an empty message id withInvalidParamsError; the empty-tenant and empty-next-page-token proto defaults are normalized back tonullper the spec convention.How I checked
mvn test -pl spec-grpc -am— all 126 tests in the module pass, including the 20 new ones and the existing 13 inToProtoTest.One observation for reviewers: the round-trip tests assert the converters' current convention that absent optional collections/metadata on the spec side become empty collections/maps after a spec → proto → spec round trip (e.g.
nullmetadata becomes{}). The tests build their fixtures with canonical empty values to pin this behavior.