mirror of
https://github.com/esphome/esphome.git
synced 2026-05-24 01:37:15 +08:00
[core] Strengthen scheduler-pool integration test with lower-bound check
Adds an assertion that the observed peak pool size exceeds the old MAX_POOL_SIZE=5 cap. Without this, a silent regression that re-introduced a small cap could pass the existing pool_full_count == 0 invariant. Phase 5 + 6 of the fixture schedule 8 + 10 same-component timeouts, so the peak should comfortably exceed 5. Address Copilot review feedback on PR.
This commit is contained in:
@@ -185,6 +185,18 @@ async def test_scheduler_pool(
|
||||
f"Pool should never report full (got {pool_full_count})"
|
||||
)
|
||||
|
||||
# Verify the pool actually grew past the old MAX_POOL_SIZE=5 cap.
|
||||
# Phase 5 + Phase 6 schedule 8 + 10 same-component timeouts respectively, so the
|
||||
# observed peak should comfortably exceed 5. Without this lower-bound check, a
|
||||
# silent regression that re-introduced a small cap could pass the test above.
|
||||
max_pool_size = 0
|
||||
for line in log_lines:
|
||||
if match := recycle_pattern.search(line):
|
||||
max_pool_size = max(max_pool_size, int(match.group(1)))
|
||||
assert max_pool_size > 5, (
|
||||
f"Pool should grow past the old cap of 5; observed peak {max_pool_size}"
|
||||
)
|
||||
|
||||
# Log summary for debugging
|
||||
print("\nScheduler Pool Test Summary (Python Orchestrated):")
|
||||
print(f" Items recycled to pool: {pool_recycle_count}")
|
||||
|
||||
Reference in New Issue
Block a user