Repository navigation
Commit 51fbc27
committed
test: cover stale-heap-entry branch in _async_evict_oldest
Adds ``test_cache_eviction_skips_stale_heap_entries`` which fills the
cache to ``_MAX_CACHE_RECORDS``, re-adds the closest-to-expiration
record with a longer TTL (which leaves a stale ``(when, record)``
tuple at the head of ``_expire_heap`` and updates ``_expirations``
with the new ``when``), then forces a single eviction and asserts the
refreshed record survives while the next-oldest legitimate record is
the one that gets evicted. Without this test the ``continue`` branch
inside ``_async_evict_oldest`` would be untouched by the suite.1 parent c24fa39 commit 51fbc27
1 file changed
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
517 | 570 | | |
518 | 571 | | |
519 | 572 | | |
| |||
0 commit comments