DeploymentManager: process-wide static purge rate limiter blocks testing the purge failure path #90
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The deployment-record purge rate limiter used by
TryPurgeTerminalDeploymentRecordsAsyncis 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.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).