test(grpc): expand client.cpp coverage#1069
Merged
Merged
Conversation
Add 36 unit tests to tests/test_grpc_client_server.cpp targeting the surface of grpc_client reachable without a connected gRPC peer. Coverage scope (disconnected-state surface): - call_raw input variations (empty, slash-only, large request, expired deadline, future deadline, wait_for_ready, custom metadata) - server_stream_raw / client_stream_raw / bidi_stream_raw guards (empty method, missing leading slash, metadata-bearing options) - Constructor / target variations (empty, IPv4, long string, special characters) - connect() boundary inputs (non-numeric port, multi-colon target, insecure TLS, custom keepalive, zero retry attempts) - Multi-instance state isolation and move-assignment safety - call_options edges (zero timeout, very large timeout, ordered metadata of size 10) - grpc_message edges (parse short/empty buffers, embedded nulls, large payload, full byte range, header-only serialization) These tests do not exercise the post-connect frame I/O loop, which requires an in-process gRPC loopback fixture not present in this tree. The acceptance criteria of #1063 (>=80% line / >=70% branch) is therefore not met by this PR; the remaining gap is tracked under #953. Part of #1063 Part of #953
Contributor
Coverage Report
Coverage DetailsFull HTML report is available as a build artifact. |
This was referenced Apr 27, 2026
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.
What
Add 36 focused unit tests to
tests/test_grpc_client_server.cppthat exercise reachable code paths insrc/protocols/grpc/client.cppwithout a connected gRPC peer.Change Type
Affected Components
tests/test_grpc_client_server.cpp— +373 LOC, +36 test cases (no source/build changes)Why
Part of #1063(and the parent epicPart of #953) — narrow test-expansion across worst-coverage protocol files.Pre-PR baseline (2026-04-26 lcov):
client.cpp22.6% line / 9.5% branch. Existing tests intests/test_grpc_client_server.cpp(added via #994) cover happy paths only; this PR fills in error-path and boundary cases for the surface that does not require a live gRPC server.Where
call_rawinput variations (disconnected)server_stream_raw/client_stream_raw/bidi_stream_rawguardsconnect()boundary inputscall_optionsedgesgrpc_messageedgesHow
Implementation Approach
tests/test_grpc_client_server.cpp(no parallel suite)GrpcClientTest,GrpcCallOptionsTest, andGrpcMessageTestGTest fixturesCoverage Scope (Honest Assessment)
This PR does not reach the
>=80% line / >=70% branchacceptance criteria of #1063. The remaining gap is concentrated in the post-connect code path: the HTTP/2-backed unary and streaming transport,start_streamcallbacks, gRPC framing/parsing on real wire bytes, and trailer extraction. Those paths require an in-process gRPC loopback fixture that does not currently exist in the test tree.Building the loopback fixture is a larger, separate piece of work (HTTP/2 server with
grpc-statustrailer support, hermetic ALPN negotiation, stream lifecycle handling) and is tracked under #953. This PR therefore usesPart of #1063rather thanCloses #1063and the issue stays open.Test Plan
Breaking Changes
None — test-only addition.
Rollback Plan
Revert this single commit; no schema, ABI, or build surface affected.
Part of #1063
Part of #953