fix(mockserver): implement PingAndWarm stub - #335
Open
sushanb wants to merge 1 commit into
Open
Conversation
The fake Server embeds btpb.BigtableServer as an interface without implementing PingAndWarm, so clients that prime channels (Direct-Path warmup, classic pool priming, session-pool warmup) nil-deref on the very first RPC before any test-attached mock function runs. Add a stub that returns an empty response by default and expose a PingAndWarmFn hook for tests that want to override the behavior (matches the pattern used by every other RPC on the fake).
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.
Summary
The fake
Serverintests/mockserver.goembedsbtpb.BigtableServeras an interface without implementing
PingAndWarm. Any client thatprimes its managed channel pool — DirectPath warmup, classic pool
pingAndWarmChannelPrimer, upcoming session-pool warmup — nil-derefson the very first RPC because the embedded interface field is nil.
Symptom is a
runtime error: invalid memory address or nil pointer dereferenceinside_Bigtable_PingAndWarm_Handlerbefore anytest-attached mock function ever runs — reproducible today by pointing
the Go test proxy (
google-cloud-go/bigtable/internal/testproxy) atthis suite with any client version that calls
PingAndWarmduringchannel priming.
Fix: implement
PingAndWarmfollowing the same pattern used by everyother RPC on the fake — an optional
PingAndWarmFnhook, defaultingto an empty response so channel priming just succeeds. Tests that
want to observe or fail the ping can attach a custom
PingAndWarmFn.Test plan
go build ./tests/...panics on the first RPC