decoder: honor context cancellation in DecodeURL #598
Hi @git-jxj. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.
>[!TIP]
>We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
<details>
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
</details>
/ok-to-test
thanks
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/e2e-framework/pull/598#pullrequestreview-5425695264" title="Approved">cpanato</a>, <a href="https://github.com/kubernetes-sigs/e2e-framework/pull/598#" title="Author self-approved">git-jxj</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
cpanato
git-jxj
What type of PR is this?
/kind bug
What this PR does / why we need it:
DecodeURLaccepts a context, but its HTTP request uses a background context. Cancelling the supplied context therefore cannot interrupt waiting for response headers or an unfinished response body.Pass the supplied context to the HTTP request and cover both cancellation phases with HTTP regression tests. The body test first confirms that a YAML object has been decoded before cancelling the remaining download.
Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
Verified both regressions before the fix and passed 20 runs with the race detector afterward. Decoder package test compilation,
go vet, boilerplate verification, module verification, and repository-pinned golangci-lint checks pass. The regression tests were run as standalone HTTP unit tests; the full decoder Kind integration suite was not run.OpenAI Codex generated the implementation, tests, commit message, and PR description, and ran the local verification.
Does this PR introduce a user-facing change?
``
release-note
``DecodeURL now cancels HTTP downloads when the supplied context is cancelled or its deadline expires.
docs
NONE