Commit 78d2573
test(metrics): rewrite skipped suites on registry/snapshot fixtures
The metrics pub/sub refactor (PR #N) module-level-skipped four test
files plus their conftest because they hard-coupled to the deleted
KVStore API. This commit reinstates them on the new fixtures, in
scope with the design doc's "test impact" callout.
- conftest.py: rewrites shared fixtures to construct MetricsRegistry
and MetricsTable instances directly. Drops events_db (SQLite
fixture deleted with the KVStore path).
- test_metrics_table.py: 16 tests covering tracking-window lifecycle,
trigger dispatch on field updates, tracked-block accounting, and
the in-flight async-task drain path.
- test_aggregator.py: 31 tests covering MetricsAggregatorService end
to end (in-process, MagicMock publisher) — counter accounting,
ISSUED/COMPLETE/error event handling, ENDED → publish_final
sequence, and the LIVE → DRAINING state transition. Adds a new
TestCounterAccounting class to cover the total_* vs tracked_*
counter split that the legacy tests conflated.
- test_aggregator_e2e.py: 3 tests round-tripping a real
MetricsPublisher ↔ MetricsSnapshotSubscriber over IPC, covering
COMPLETE-only delivery, LIVE-tick-then-COMPLETE lifecycle, and
counter+series wire shape.
- test_report_builder.py: 14 tests on Report.from_snapshot, including
the complete=False derivation when state != COMPLETE or
n_pending_tasks > 0.
Net: 64 new tests across the 4 suites; full unit suite up from
660 to 724 passing. The 4 module-level skips are gone.
Production-code surfaces flagged for follow-up coverage:
- AsyncTokenTrigger exception path in metrics_table.py
- SeriesSampler HDR clamp warn-once branch
- MetricsAggregatorService._finalize shutdown_event signaling
- Report.tps() OSL-empty-with-duration case
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1a72e81 commit 78d2573
5 files changed
Lines changed: 1915 additions & 54 deletions
File tree
- tests/unit
- async_utils/services/metrics_aggregator
- metrics
Lines changed: 105 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
30 | 45 | | |
31 | 46 | | |
32 | 47 | | |
| |||
35 | 50 | | |
36 | 51 | | |
37 | 52 | | |
38 | | - | |
39 | | - | |
| 53 | + | |
40 | 54 | | |
41 | 55 | | |
42 | 56 | | |
| |||
86 | 100 | | |
87 | 101 | | |
88 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
0 commit comments