test(mock): observe fetch RPC timeout firing on a silent later chunk (TEST-7) - #377
Open
fornwall wants to merge 1 commit into
Open
test(mock): observe fetch RPC timeout firing on a silent later chunk (TEST-7)#377fornwall wants to merge 1 commit into
fornwall wants to merge 1 commit into
Conversation
…(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
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.
TEST-7 — Fetch timeout never observed firing
Adds
fetch_timeout_fires_on_a_reader_hung_on_a_silent_streamtotests/mock_spanner.rs, pinning that a hung later-chunk fetch surfacesStatus::Timeoutwhenspanner.rpc.timeout_seconds.fetchis set — the deadlinespawn_prefetchwraps eachpull_chunkin, previously unexercised end-to-end through the wire.What the test does
cancel_unblocks_a_reader_hung_on_a_silent_stream, now factored into a sharedsilent_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".spanner.rpc.timeout_seconds.fetch=0.5with one row per batch: the firstnext()yields the buffered row; the second — the later-chunk fetch that blocks forever — must return an ADBC error withStatus::Timeoutnaming the fetch option.>= 0.5sfloor (timed from beforeexecute, since the prefetch's second fetch begins duringexecute) 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 secondnext()then hangs forever (the cancel twin proves the same silent stream never ends on its own) and theWatchdogfires — only the driver's deadline can end it.Checks
cargo fmt --all --check— passcargo clippy --all-targets --all-features -- -D warnings— passcargo 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