Skip to content

test(alerts): add unit tests for AlertDeriver.get_threshold/get_threshold_async - #314

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

test(alerts): add unit tests for AlertDeriver.get_threshold/get_threshold_async#314
acailic wants to merge 1 commit into
mainfrom
fix/issue-311-alert-deriver-tests

Conversation

@acailic

@acailic acailic commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds tests/alerts/test_alert_deriver_base.py covering AlertDeriver.get_threshold and get_threshold_async on collector/alerts/base.py (previously 0% coverage on lines 44-50, 68-74)
  • 9 new tests: no policy_getter, sync policy (enabled/disabled/None), async policy_getter behavior (including the documented sync-context limitation where get_threshold returns the default immediately instead of awaiting)

Fixes #311

Test plan

  • ruff check . — all checks passed
  • python3 -m pytest -q tests/alerts/test_alert_deriver_base.py — 9 passed, no warnings
  • python3 -m pytest -q (full suite) — 3162 passed, 19 skipped, 15 deselected

🤖 Generated with Amplifier

…hold_async

Covers the sync/async policy-getter paths on collector/alerts/base.py
(lines 44-50, 68-74), including the documented sync-context limitation
where get_threshold returns the default immediately for an async
policy_getter instead of awaiting it.

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