Skip to content

test: assert list_services response uses proper protobuf structs#78

Merged
mjheilmann merged 4 commits intoelixir-grpc:mainfrom
yordis:yordis/test-assert-protobuf-struct-response-types
Apr 13, 2026
Merged

test: assert list_services response uses proper protobuf structs#78
mjheilmann merged 4 commits intoelixir-grpc:mainfrom
yordis:yordis/test-assert-protobuf-struct-response-types

Conversation

@yordis
Copy link
Copy Markdown
Contributor

@yordis yordis commented Apr 13, 2026

  • Protobuf 0.16 deprecated implicit coercion of plain maps to message structs — returning %{service: [...]} instead of %Grpc.Reflection.V1.ListServiceResponse{service: [...]} from reflect/2 triggers deprecation warnings today and will raise in a future version. The implementation was corrected in bump protobuf, and partition process.ex to fix warnings #76, but no tests guarded the contract.
  • The existing integration tests for list_services used %{service: service_list} (plain map pattern) and Map.get(&1, :name), both of which match structs and plain maps equally — so they could not detect a regression back to plain maps even though the roundtrip encode/decode masks the problem anyway.
  • Adds a direct unit test for GrpcReflection.Server.V1.reflect/2 that bypasses the gRPC roundtrip and asserts %Grpc.Reflection.V1.ListServiceResponse{} and %Grpc.Reflection.V1.ServiceResponse{} struct types explicitly.
  • Updates both v1 and v1alpha integration tests to use struct patterns and field access instead of plain map patterns and Map.get/2.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis yordis force-pushed the yordis/test-assert-protobuf-struct-response-types branch from e7b767f to 76d9059 Compare April 13, 2026 00:30
yordis added 2 commits April 12, 2026 20:37
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
Copy link
Copy Markdown
Contributor Author

yordis commented Apr 13, 2026

@mjheilmann just adding a test to add a bit of more guardrails

@mjheilmann mjheilmann merged commit 0f3ceb7 into elixir-grpc:main Apr 13, 2026
11 checks passed
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.

2 participants