Repository navigation
Conversation
agammann
left a comment
There was a problem hiding this comment.
These regression tests use the production 60-second timeout. Even with t.Parallel, TestDownloadSlowBodyExceedsClientTimeout sleeps six times for 15 seconds, so every non-short updater test run now takes at least 90 seconds (the comment says about 75). Could the internal download helper accept a timeout parameter, with the production caller passing clientTimeout, so the progress and stall cases can use millisecond deadlines in tests? I reviewed the diff; I did not run tests locally.
…deadlines download() now takes the stall timeout as an argument. The production caller in Apply passes clientTimeout, so production behaviour is unchanged. The slow-body and stall tests now use a 500ms deadline instead of the 60s production timeout, and the testing.Short skips are removed. The updater package drops from about 90s to under 1s. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
|
Thanks @agammann, addressed in 1091e80.
|
|
Thanks for the update. I rechecked head |
Problem
cloudflared updateusedhttp.Client{Timeout: 60s}, which caps the whole request, including reading the body. On slow links a download that is still making progress is cut off after 60 seconds withcontext deadline exceeded (Client.Timeout or context cancellation while reading body).Change
clientTimeout(60s) and re-armed on every body read, so a download is aborted only when no data arrives for 60 seconds.download stalled for 1m0s without data: ....cmd/cloudflared/updater/workers_update_test.go:TestDownloadSlowBodyExceedsClientTimeout: a body that takes about 90 seconds overall, with gaps of 15 seconds, downloads completely.TestDownloadStalledBodyFails: a body that stops after a partial write fails with the stall error.TestDownloadNoResponseFails: a server that sends no headers fails with the stall error.The slow-body test fails on the base commit with
Client.Timeout or context cancellation while reading body, which is the reported error.Not addressed: the issue also asks for several download retries. This change does not add retry logic.
Testing
go test -count=1 -run TestDownloadSlowBodyExceedsClientTimeout ./cmd/cloudflared/updater/: passes with the fix. It fails on the base commit withClient.Timeout or context cancellation while reading body.go test -count=1 -run 'TestDownload' -v ./cmd/cloudflared/updater/: all three download tests pass.go vet ./cmd/cloudflared/updater/: no output.The download tests take about 90 seconds in total, because they run in real time.
make lintwas not run in this session.Regression test: fails on base three times (/Client.Timeout/), passes on fix three times (
go test -count=1 -run TestDownloadSlowBodyExceedsClientTimeout ./cmd/cloudflared/updater/)Fixes #1493