[backendscheduler] test: cover that measureTenants keeps the outstanding-blocks gauge alive during redaction - #7716
Draft
zalegrala wants to merge 1 commit into
Draft
Conversation
… a redaction The measurement selector that keeps compaction_outstanding_blocks reporting real work while a tenant's compaction is gated (grafana#6992) had a unit test, but nothing asserted measureTenants actually used it — swapping the call back to the TenantPending-guarded selector left the whole suite green. Since the worker autoscaler scales on that gauge, the regression would scale workers down underneath a running redaction and only surface as the redaction getting slower. This asserts the gauge itself after measureTenants, so the wiring is covered rather than just the selector, and narrows the older test's comment to what it actually checks.
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 this PR does:
Adds the missing coverage for a fix that was silently unprotected.
compaction_outstanding_blocksmust keep reporting real work while a tenant's compaction is gated by a redaction batch — the worker autoscaler scales on that gauge, so a zero reading scales workers down underneath a running redaction and only surfaces as the redaction getting slower the longer it runs. That was fixed in #6992 by givingmeasureTenantsits own selector (newBlockSelectorForMeasurement) that skips theTenantPendingguard.The selector had a unit test. Nothing asserted that
measureTenantsactually used it: swapping the call back to the gatednewBlockSelectorleaves the entire suite green, so the regression could return unnoticed.This adds
TestCompactionProvider_MeasureTenantsPublishesBlocksDuringRedaction, which callsmeasureTenants()with a gated tenant and asserts the gauge itself is non-zero — covering the wiring rather than just the selector. Verified by mutation: green as-is, red when the call is swapped back.Also narrows the existing test's comment, which claimed it ensured "the outstanding-blocks metric (and therefore autoscaling) is not disrupted" while never touching the metric or the caller.
Test-only; no production change.
Which issue(s) this PR fixes:
N/A — follow-up coverage for #6992.
Checklist
.chloggen/(test-only, no user-facing change)