Commit e5b509a
committed
test: DNSNsec at-cap eviction + unbounded benchmark pool
**Cross-type NSec spot-test (Kōan).** Add
``test_cache_dnsnsec_at_cap_evicts_prior_record``: fill the cache to
``_MAX_CACHE_RECORDS`` with ``DNSAddress`` records, add a single
``DNSNsec``, assert the counter stays at cap (NSEC routed through
eviction), the NSEC is reachable via ``cache.cache[nsec.key]``
(orphan fix covers NSEC's key-collision path), and the earliest
fill record was the eviction victim. Complements the existing flood
test — together they pin NSEC against both ``new``-flag drift and
cross-type ``_async_add`` regressions. Uses direct cache lookup
instead of ``async_get_unique`` because the latter's type stub
excludes ``DNSNsec``.
**Unbounded benchmark generator (Copilot inline at
test_cache_bound.py:53).** The previous bench used
``iter(_make_records(100_000, ...))`` which raises ``StopIteration``
once exhausted — fast operations under pytest-codspeed can exceed
that count. Replace with ``_unbounded_records`` (``itertools.count``
+ lazy ``DNSAddress`` construction) so the iterator survives any
iteration count CodSpeed chooses. The construction work moves into
the timed body but is a constant per-iteration overhead and doesn't
distort relative measurements across runs.1 parent 38b1517 commit e5b509a
2 files changed
Lines changed: 47 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | | - | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
25 | 41 | | |
26 | 42 | | |
27 | 43 | | |
| |||
38 | 54 | | |
39 | 55 | | |
40 | 56 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
47 | 63 | | |
48 | | - | |
49 | | - | |
| 64 | + | |
50 | 65 | | |
51 | 66 | | |
52 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
586 | 611 | | |
587 | 612 | | |
588 | 613 | | |
| |||
0 commit comments