Skip to content

Commit 571566a

Browse files
Nik Samokhvalovclaude
andcommitted
test: Add 99 coverage boost tests, bring coverage to 77%
Add comprehensive unit tests targeting untested code paths in postgres_reports.py: - Connection methods (test/close postgres sink) - Query methods (instant, range, error handling) - Formatting methods (bytes, epochs, settings, memory parsing) - Data processing (prometheus_to_dict, process_pgss_data) - Report extraction (extract_postgres_version_from_a003) - Edge cases (memory parsing, qid regex, timeline) Coverage improved from 74% to 77% with 99 new tests in test_coverage_boost.py. Update TMP_TESTCOV.md with current coverage metrics table. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a8bf131 commit 571566a

File tree

2 files changed

+1213
-9
lines changed

2 files changed

+1213
-9
lines changed

TMP_TESTCOV.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ reporter:coverage-baseline:
6565
6666
| Tier | Scope | Line | Branch | Gate | Failure Consequence |
6767
|------|-------|------|--------|------|---------------------|
68-
| **Critical** | `reporter/postgres_reports.py` (P0 functions) | 95%+ | 90%+ | Fail pipeline | Wrong memory recommendations → OOM or wasted resources on customer PostgreSQL |
68+
| **Critical** | `reporter/postgres_reports.py` (ALL code) | 85%+ | 80%+ | Fail pipeline | Migration safety: all Python behavior documented via tests |
6969
| **High** | `monitoring_flask_backend/*.py` | 85%+ | 80%+ | Fail MR | API contract break, broken CSV output |
7070
| **Medium** | `cli/lib/*.ts` | 75%+ | 70%+ | Warn (log message) | Lower risk, tested via integration |
7171
| **Low** | `components/index_pilot/*.sh` | N/A | N/A | Shellcheck only | E2E covers critical paths |
@@ -923,14 +923,23 @@ def test_with_different_responses(prom_response):
923923

924924
### Quantitative
925925

926-
| Metric | Target | Measured How |
927-
|--------|--------|--------------|
928-
| Compliance vectors pass | 100% (non-skipped) | pytest harness |
929-
| Golden snapshots stable | No unexpected diffs | 3 CI runs on same commit |
930-
| Diff coverage on MRs | 90%+ | diff-cover JSON |
931-
| CI time (total) | <3min | GitLab metrics |
932-
| Flaky test rate | <1% of executions | 100 runs with `--count=3` |
933-
| P0 function coverage | 95%+ | pytest-cov (secondary) |
926+
| Metric | Target | Current | Measured How |
927+
|--------|--------|---------|--------------|
928+
| Reporter line coverage | 85%+ | **77%** | pytest-cov |
929+
| Compliance vectors pass | 100% (non-skipped) | **100%** | pytest harness (44 tests) |
930+
| Golden snapshots stable | No unexpected diffs | **** | 3 CI runs on same commit |
931+
| Property tests | 13+ tests | **13** | Hypothesis |
932+
| Coverage boost tests | 50+ tests | **99** | test_coverage_boost.py |
933+
| Total test count | 250+ | **278** | pytest |
934+
| Diff coverage on MRs | 90%+ | - | diff-cover JSON |
935+
| CI time (total) | <3min | - | GitLab metrics |
936+
| Flaky test rate | <1% of executions | - | 100 runs with `--count=3` |
937+
938+
**Coverage Progress:**
939+
- Started at: ~70% (Phase 1)
940+
- Current: 77% (after test_coverage_boost.py)
941+
- Remaining gap: ~160 lines in `postgres_reports.py`
942+
- Primary uncovered: Report generation methods requiring complex Prometheus/DB mocks
934943

935944
### Qualitative
936945

0 commit comments

Comments
 (0)