Skip to content

[backendscheduler] test: cover that measureTenants keeps the outstanding-blocks gauge alive during redaction - #7716

Draft
zalegrala wants to merge 1 commit into
grafana:mainfrom
zalegrala:redaction-measure-coverage
Draft

[backendscheduler] test: cover that measureTenants keeps the outstanding-blocks gauge alive during redaction#7716
zalegrala wants to merge 1 commit into
grafana:mainfrom
zalegrala:redaction-measure-coverage

Conversation

@zalegrala

Copy link
Copy Markdown
Contributor

What this PR does:

Adds the missing coverage for a fix that was silently unprotected.

compaction_outstanding_blocks must 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 giving measureTenants its own selector (newBlockSelectorForMeasurement) that skips the TenantPending guard.

The selector had a unit test. Nothing asserted that measureTenants actually used it: swapping the call back to the gated newBlockSelector leaves the entire suite green, so the regression could return unnoticed.

This adds TestCompactionProvider_MeasureTenantsPublishesBlocksDuringRedaction, which calls measureTenants() 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

  • Tests updated
  • Documentation added
  • Changelog entry added under .chloggen/ (test-only, no user-facing change)

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant