DeploymentManager: process-wide static purge rate limiter blocks testing the purge failure path #90

Closed
opened 2026-11-09 13:11:21 -05:00 by dohertj2 · 1 comment
Owner

The deployment-record purge rate limiter used by TryPurgeTerminalDeploymentRecordsAsync is a process-wide static, so only one test in the assembly can exercise it and its swallow-on-failure path is untested (found while backfilling #73). Make the limiter per-instance (or inject a TimeProvider-driven limiter) and add a test for the swallowed-failure path.

The deployment-record purge rate limiter used by `TryPurgeTerminalDeploymentRecordsAsync` is a process-wide static, so only one test in the assembly can exercise it and its swallow-on-failure path is untested (found while backfilling #73). Make the limiter per-instance (or inject a TimeProvider-driven limiter) and add a test for the swallowed-failure path.
dohertj2 added the type:testpriority:p3 labels 2026-11-09 13:11:21 -05:00
Author
Owner

Fixed on main 51d2f6c9: new TerminalPurgeRateLimiter (injectable clock), registered TryAddSingleton so the scoped DeploymentService still shares one limit per node (optional last ctor parameter). TerminalPurgeRateLimiterTests: one sweep per interval and exactly one winner among 16 concurrent callers; unshared limiters independent; cutoff from the injected clock; failed purge logged + swallowed, already-deleted rows still reported, next run waits a full interval; singleton registration. Back to a static fails 5 tests; narrowing the catch fails the 2 failure-path tests. Evidence: slnx 0 warnings/0 errors after rebase; TemplateEngine, ManagementService, Transport, Transport.IntegrationTests, ConfigurationDatabase passed; DeploymentManager passed 3/3 re-runs (one earlier run hit the separately-filed DeploySiteAsync flake).

Fixed on main 51d2f6c9: new TerminalPurgeRateLimiter (injectable clock), registered TryAddSingleton so the scoped DeploymentService still shares one limit per node (optional last ctor parameter). TerminalPurgeRateLimiterTests: one sweep per interval and exactly one winner among 16 concurrent callers; unshared limiters independent; cutoff from the injected clock; failed purge logged + swallowed, already-deleted rows still reported, next run waits a full interval; singleton registration. Back to a static fails 5 tests; narrowing the catch fails the 2 failure-path tests. Evidence: slnx 0 warnings/0 errors after rebase; TemplateEngine, ManagementService, Transport, Transport.IntegrationTests, ConfigurationDatabase passed; DeploymentManager passed 3/3 re-runs (one earlier run hit the separately-filed DeploySiteAsync flake).
Sign in to join this conversation.