Test poller target halves on ResourceExhausted#2392
Open
veeral-patel wants to merge 1 commit into
Open
Conversation
Add TestAutoscalingHalvesOnResourceExhausted to ScalableTaskPollerSuite, asserting that a ResourceExhausted poll error halves the poller target (16 -> 8 -> 4) while other errors only decrement by one, and that the halved value reaches the live pollerSemaphore via the scaleCallback wiring set up by newScalableTaskPoller. This complements TestErrorScaleDown (which asserts the same arithmetic against a mock scaleCallback) by verifying the real semaphore is resized.
yuandrew
reviewed
Jun 15, 2026
yuandrew
left a comment
Contributor
There was a problem hiding this comment.
looks like go run . check is failing
| serverSupportsAutoscaling := &atomic.Bool{} | ||
| serverSupportsAutoscaling.Store(true) | ||
|
|
||
| poller := newScalableTaskPoller(&semaphoreProbeTaskPoller{}, ilog.NewNopLogger(), behavior, serverSupportsAutoscaling) |
Contributor
There was a problem hiding this comment.
Can we use newSemaphoreProbeTaskPoller here? All of the other tests use this helper to create the poller
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.
What
Adds
TestAutoscalingHalvesOnResourceExhaustedtoScalableTaskPollerSuiteininternal/internal_worker_base_test.go.The test drives
pollScalerReportHandle.handleError(built through the productionnewScalableTaskPollerwiring) and asserts the livepollerSemaphoremax permits follow the halving sequence:ResourceExhaustedResourceExhaustedInternal)ResourceExhaustedResourceExhaustedWhy
Asserting the exact step size —
16→8→4forResourceExhaustedversus4→3for a non-ResourceExhaustederror — is what distinguishes halving (t/2) from a plain-1decrement. A regression in either direction (RE stops halving, or halving leaks to other error types) fails the test.This complements the existing
PollScalerReportHandleSuite.TestErrorScaleDown, which asserts the same arithmetic against a mockscaleCallback. The new test additionally verifies the halved value reaches the realpollerSemaphorethrough thescaleCallback → updatePermitswiring thatnewScalableTaskPollersets up.Notes
semaphoreProbeTaskPollerandreadSemaphoreStatehelpers; no production code changes.Test