make resolver goroutine-leak tests deterministic#10361
Open
anxkhn wants to merge 1 commit into
Open
Conversation
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.
Collaborator
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Author
|
/kind cleanup |
Author
|
/assign @aThorp96 |
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.
Changes
Fixes #10105.
TestResolveGoroutineLeak(in both the resolution and remoteresolutionframework packages) used
runtime.NumGoroutine()before and after a batch oftimed-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
Resolvesignalswhen 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 blockingforever on its result channel. That tests the buffered (cap-1)
errChan/resourceChancontract directly: it passes with the buffered channelsand 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:
/kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes