Skip to content

test(mock): observe fetch RPC timeout firing on a silent later chunk (TEST-7) - #377

Open
fornwall wants to merge 1 commit into
mainfrom
test-7-fetch-timeout
Open

test(mock): observe fetch RPC timeout firing on a silent later chunk (TEST-7)#377
fornwall wants to merge 1 commit into
mainfrom
test-7-fetch-timeout

Conversation

@fornwall

Copy link
Copy Markdown
Owner

TEST-7 — Fetch timeout never observed firing

Adds fetch_timeout_fires_on_a_reader_hung_on_a_silent_stream to tests/mock_spanner.rs, pinning that a hung later-chunk fetch surfaces Status::Timeout when spanner.rpc.timeout_seconds.fetch is set — the deadline spawn_prefetch wraps each pull_chunk in, previously unexercised end-to-end through the wire.

What the test does

  • Reuses the silent-stream script from cancel_unblocks_a_reader_hung_on_a_silent_stream, now factored into a shared silent_after_first_row_server() helper (one row, then the stream's sender is parked alive so it never ends). The cancel test's own doc already called this "the foundation for future timeout tests".
  • Sets spanner.rpc.timeout_seconds.fetch=0.5 with one row per batch: the first next() yields the buffered row; the second — the later-chunk fetch that blocks forever — must return an ADBC error with Status::Timeout naming the fetch option.
  • A >= 0.5s floor (timed from before execute, since the prefetch's second fetch begins during execute) rules out an unrelated transport failure racing the deadline.

This is the gating twin of resilience's Toxiproxy timeout assertion (its cancel twin already existed as the mock silent-stream cancel test): it needs no proxy, so it runs offline in every cargo test.

Non-vacuity

Verified by disabling the deadline (fetch=0.0): the second next() then hangs forever (the cancel twin proves the same silent stream never ends on its own) and the Watchdog fires — only the driver's deadline can end it.

Checks

  • cargo fmt --all --check — pass
  • cargo clippy --all-targets --all-features -- -D warnings — pass
  • cargo test --test mock_spanner — 39 passed (new test in 0.51s; refactored cancel test still green)

🤖 Generated with Claude Code

https://claude.ai/code/session_01EaKycJ7J9wtPMYcvqSGmck

…(TEST-7)

Add `fetch_timeout_fires_on_a_reader_hung_on_a_silent_stream` in
tests/mock_spanner.rs: with `spanner.rpc.timeout_seconds.fetch=0.5` and one
row per batch, the first `next()` yields the buffered row and the second —
the later-chunk fetch that blocks forever on a stream gone silent — must
surface `Status::Timeout` naming the fetch option, the deadline
`spawn_prefetch` wraps each `pull_chunk` in. A `>= 0.5s` floor (timed from
before `execute`) rules out a transport failure racing the deadline.

The silent-stream scaffolding from the cancel test is factored into a shared
`silent_after_first_row_server()` helper (its doc already called itself "the
foundation for future timeout tests"), now serving both the cancel test and
this fetch-timeout twin. This is the gating twin of resilience's Toxiproxy
timeout assertion — it runs offline in every `cargo test`.

Non-vacuous: with the deadline disabled (`0.0`) the second `next()` hangs
forever (the cancel twin proves the stream never ends on its own).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EaKycJ7J9wtPMYcvqSGmck
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