Skip to content

test: add unit tests for AlertDeriver.get_threshold/get_threshold_async - #321

Open
acailic wants to merge 1 commit into
mainfrom
fix/issue-311-alert-deriver-coverage
Open

acailic wants to merge 1 commit into
mainfrom
fix/issue-311-alert-deriver-coverage

Conversation

@acailic

@acailic acailic commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/alerts/test_alert_deriver_base.py covering AlertDeriver.get_threshold and get_threshold_async in collector/alerts/base.py (was 27.78% covered, lines 44-50 and 68-74 were untested)
  • Covers: no policy_getter, sync policy_getter (threshold + disabled + None), async policy_getter in sync context (documented default-fallback limitation), and async policy_getter in get_threshold_async (awaited correctly)

Test plan

  • ruff check . — all checks passed
  • pytest -q tests/alerts/test_alert_deriver_base.py — 9 passed
  • pytest -q -m 'not e2e' (full suite) — 3116 passed, 34 skipped, 46 deselected

Fixes #311

🤖 Generated with Amplifier

collector/alerts/base.py sat at 27.78% coverage with no direct tests
for get_threshold/get_threshold_async. Adds tests/alerts/test_alert_deriver_base.py
covering sync/async policy_getter, disabled policy, missing policy,
and the documented sync-context limitation (async getter in the sync
get_threshold falls back to default).

Fixes #311

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for AlertDeriver.get_threshold/get_threshold_async (27% coverage)

1 participant