Skip to content

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

Open
acailic wants to merge 1 commit into
mainfrom
test/311-alert-deriver-base-coverage
Open

test: add unit tests for AlertDeriver.get_threshold/get_threshold_async#312
acailic wants to merge 1 commit into
mainfrom
test/311-alert-deriver-base-coverage

Conversation

@acailic

@acailic acailic commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • collector/alerts/base.py (AlertDeriver) sat at 27.78% coverage — get_threshold and get_threshold_async had no direct unit tests
  • Adds tests/alerts/test_alert_deriver_base.py with 9 tests via a minimal concrete subclass, covering: no policy getter, sync policy getter (enabled / disabled / returns None), and async policy getter (properly awaited in get_threshold_async, falls back to default when called from the sync get_threshold)
  • File now at 100% statement + branch coverage

Fixes #311

Test plan

  • ruff check . — clean
  • pytest tests/alerts/test_alert_deriver_base.py -v — 9/9 pass
  • pytest --cov=collector.alerts.base — 100% coverage, no warnings
  • Full suite: pytest -q — 3162 passed (3153 prior + 9 new), 19 skipped (pre-existing, missing optional deps), 0 failures

🤖 Generated with Amplifier

collector/alerts/base.py sat at 27.78% coverage with no direct tests for
the sync/async threshold-resolution logic. Adds 9 tests covering: no
policy getter, sync getter (enabled/disabled/None), and async getter
(awaited vs. sync-context fallback). File now at 100% coverage.

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