Skip to content

fix(mockserver): implement PingAndWarm stub - #335

Open
sushanb wants to merge 1 commit into
googleapis:mainfrom
sushanb:fix/fake-pingandwarm
Open

fix(mockserver): implement PingAndWarm stub#335
sushanb wants to merge 1 commit into
googleapis:mainfrom
sushanb:fix/fake-pingandwarm

Conversation

@sushanb

@sushanb sushanb commented Jul 30, 2026

Copy link
Copy Markdown

Summary

The fake Server in tests/mockserver.go embeds btpb.BigtableServer
as an interface without implementing PingAndWarm. Any client that
primes its managed channel pool — DirectPath warmup, classic pool
pingAndWarmChannelPrimer, upcoming session-pool warmup — nil-derefs
on the very first RPC because the embedded interface field is nil.

Symptom is a runtime error: invalid memory address or nil pointer dereference inside _Bigtable_PingAndWarm_Handler before any
test-attached mock function ever runs — reproducible today by pointing
the Go test proxy (google-cloud-go/bigtable/internal/testproxy) at
this suite with any client version that calls PingAndWarm during
channel priming.

Fix: implement PingAndWarm following the same pattern used by every
other RPC on the fake — an optional PingAndWarmFn hook, defaulting
to 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/...
  • Existing conformance suite still passes locally
  • Pointing a client that primes channels at the fake no longer
    panics on the first RPC

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).
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.

1 participant