test: deterministic prewarmer env-pool eviction test - #12407
Conversation
|
Claude finished @svlachakis's task in 1m 31s —— View job Review: test de-flake for prewarmer env-pool evictionI traced the pool semantics against the actual wiring and this is a solid, well-reasoned de-flake. ✅ Why the old test was flaky (confirmed): Why the new test is deterministic (verified):
Repo-rule adherence:
FindingsLow — stale doc comment (not introduced by this PR). Low — Neither finding blocks merge. No Critical/High/Medium issues.
|
54aac11 to
166ce27
Compare
PreWarmCaches_WhenPoolEvicts_EvictedEnvsAreDisposed required two warmup workers to actually run concurrently, which is scheduler-dependent and flaked on constrained CI runners (one worker warmed both sender groups, created.Count == 1). The eviction-disposal contract is now exercised by driving the prewarmer's pool directly with two overlapping rentals.
166ce27 to
3656927
Compare
|
Claude finished @svlachakis's task in 1m 6s —— View job Review: deterministic prewarmer env-pool eviction testTraced the pool semantics against the actual wiring end-to-end. This is a correct, well-scoped de-flake. ✅ Root cause of the old flake (confirmed): New test is deterministic (verified line-by-line):
Production change: FindingsLow — stale doc comment (pre-existing, not introduced here). Low — Neither finding blocks merge. No Critical/High/Medium issues — mergeable.
|
Keep _envPool private (no internals exposed for tests). The eviction test builds its own DisposableObjectPool from the framework provider and the tracking policy, then drives sequential Get/Return on a capacity-1 pool so the eviction is deterministic. That the real prewarmer uses a disposing pool is already covered via the public Dispose() API by Dispose_WhenCalled_DisposesRetainedEnvsInPool. Production is unchanged.
bd6ea9a to
8501d34
Compare
Changes
PreWarmCaches_WhenPoolEvicts_EvictedEnvsAreDisposedassertedcreated.Count >= 2, which requires the two sender-group warmup iterations to run on two workers concurrently. That is scheduler-dependent: on a constrained runner one worker can warm both groups before the second pool thread wakes, so only one env is created and the test fails (seen on CI:Expected: greater than or equal to 2 / But was: 1).EnvPool_ReturnedBeyondCapacity_IsDisposedImmediately: it builds a capacity-1DisposableObjectPoolfrom the same framework provider and env policy, then does two overlapping rentals and two returns single-threaded — no scheduling dependence.BlockCachePreWarmeris byte-identical to master; no internals exposed for tests). That the real prewarmer wires up a disposing pool is already covered through the publicDispose()API byDispose_WhenCalled_DisposesRetainedEnvsInPool, so there is no coverage gap.Types of changes
What types of changes does your code introduce?