Skip to content

docs: correct what wait_time actually bounds - #155

Merged
tas50 merged 1 commit into
mainfrom
docs/wait-time-scope
Aug 23, 2026
Merged

tas50 merged 1 commit into
mainfrom
docs/wait-time-scope

Conversation

@tas50

@tas50 tas50 commented Aug 23, 2026

Copy link
Copy Markdown
Member

What

Fix the wait_time row in the README's Timing table, and document the transport setting that actually governs how long the driver waits for an instance to become reachable.

Why

The README said:

| wait_time | 600 | Seconds to wait for an operation or for the instance to become ready. |

The second half is not true. wait_time is passed to wait_for_status, which covers GCE operations and resource status polling. Waiting for the instance to become reachable is wait_for_server, which hands straight off to the transport:

def wait_for_server
  instance.transport.connection(state).wait_until_ready

and the transport applies its own max_wait_until_ready, which the driver does not set and cannot see.

Why it matters

Test Kitchen's SSH transport retries max_wait_until_ready / 3 times with a 3 second delay, and each attempt carries its own connection_timeout of 15 seconds. For an address that times out rather than refusing, that is roughly an hour of waiting — on a running, billing instance.

Observed with use_private_ip: true from outside the network and wait_time: 90 explicitly set:

       Server <tk-e-privateip-3a1f61> created.
       Waiting for server <tk-e-privateip-3a1f61> to be ready...
       Waiting for SSH service on 10.128.0.28:22, retrying in 3 seconds
       ... (14+ minutes, stopped by hand)

The two configurations where this bites are the two where the transport can never connect: use_private_ip from off-network, and WinRM without a VPC firewall rule for 5985 (see #154). In both cases the user has set wait_time expecting it to cap the wait, and it does nothing.

Alternative considered

The driver could wrap wait_for_server in Timeout.timeout(wait_time) so the documented behaviour becomes the real behaviour. That is arguably the better fix — it would make wait_time a genuine cost ceiling — but it changes runtime behaviour for anyone currently relying on a transport timeout longer than their wait_time, so I have kept this PR to documentation. Happy to write that version instead if you would prefer it.

🤖 Generated with Claude Code

The README described `wait_time` as "Seconds to wait for an operation or
for the instance to become ready". The second half is not true. It is
passed to `wait_for_status`, which covers GCE operations and resource
status polling only. Waiting for the instance to accept connections is
`wait_for_server`, which delegates straight to the transport:

    def wait_for_server
      instance.transport.connection(state).wait_until_ready

and the transport uses its own `max_wait_until_ready`, not the driver's
`wait_time`.

The gap is easy to hit. Test Kitchen's SSH transport retries
`max_wait_until_ready / 3` times with a 3 second delay, and each attempt
carries its own `connection_timeout` of 15 seconds, so an address that
times out rather than refusing can be waited on for roughly an hour.
Observed with `use_private_ip: true` from outside the network and
`wait_time: 90`: the driver sat in "Waiting for SSH service on
10.128.0.28:22" for over fourteen minutes on a running, billing instance
before it was stopped by hand.

Describe `wait_time` as what it is, and point at the transport setting
that governs readiness, since that is the one that matters when an
instance is unreachable rather than slow - `use_private_ip` from off
network, or WinRM with no firewall rule for 5985.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tas50
tas50 merged commit c422268 into main Aug 23, 2026
8 checks passed
@tas50
tas50 deleted the docs/wait-time-scope branch August 23, 2026 07:43
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