Skip to content

make resolver goroutine-leak tests deterministic#10361

Open
anxkhn wants to merge 1 commit into
tektoncd:mainfrom
anxkhn:loop/tekton__003
Open

make resolver goroutine-leak tests deterministic#10361
anxkhn wants to merge 1 commit into
tektoncd:mainfrom
anxkhn:loop/tekton__003

Conversation

@anxkhn

@anxkhn anxkhn commented Jun 29, 2026

Copy link
Copy Markdown

Changes

Fixes #10105.

TestResolveGoroutineLeak (in both the resolution and remoteresolution
framework packages) used runtime.NumGoroutine() before and after a batch of
timed-out resolutions and asserted the delta. That count is process-global, so
unrelated goroutines starting or stopping during the run made the test noisy.
This is the follow-up cleanup called out in the review of #10098.

This replaces the count with a controlled fake resolver whose Resolve signals
when it starts and then blocks until the test releases it. The test lets the
reconciler time out, releases the resolver, then polls for the worker's stack
frame (resolve.func1) to confirm the goroutine exits instead of blocking
forever on its result channel. That tests the buffered (cap-1)
errChan/resourceChan contract directly: it passes with the buffered channels
and fails if they are reverted to unbuffered. No production code changes; same
packages, deterministic instead of flaky.

This change was developed with AI assistance and reviewed and tested by me.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

TestResolveGoroutineLeak relied on runtime.NumGoroutine() before/after a
batch of timed-out resolutions, which is process-global and noisy when
unrelated goroutines start or stop during a run. Follow-up to tektoncd#10098.

Replace the count delta with a controlled fake resolver that signals when
Resolve starts and blocks until released. The test lets the reconciler time
out, then releases the resolver and polls for the worker's stack frame to
confirm the goroutine exits instead of blocking forever publishing its
result. This tests the buffered-channel contract directly: it passes with
the cap-1 channels and fails if they are reverted to unbuffered.

Done in both pkg/resolution and pkg/remoteresolution framework packages.
@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Jun 29, 2026
@tekton-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign athorp96 after the PR has been reviewed.
You can assign the PR to them by writing /assign @athorp96 in a comment when ready.

The full list of commands accepted by this bot can be found 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

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 29, 2026
@anxkhn

anxkhn commented Jun 29, 2026

Copy link
Copy Markdown
Author

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 29, 2026
@anxkhn

anxkhn commented Jun 30, 2026

Copy link
Copy Markdown
Author

/assign @aThorp96

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(resolver): make timeout goroutine leak tests deterministic

3 participants