Aggiunge notifier server per scheduler
This commit is contained in:
18
tests/test_server_notifier.py
Normal file
18
tests/test_server_notifier.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from bakrest.server_check import ServerStatus
|
||||
from bakrest.server_notifier import should_alert
|
||||
|
||||
|
||||
def test_notifier_alerts_once_while_server_is_down() -> None:
|
||||
status = ServerStatus(False, "now", "down")
|
||||
|
||||
assert should_alert(status, None)
|
||||
assert not should_alert(status, "unreachable")
|
||||
assert should_alert(status, "unreachable", always_alert=True)
|
||||
|
||||
|
||||
def test_notifier_does_not_alert_when_server_is_reachable() -> None:
|
||||
status = ServerStatus(True, "now", "ok")
|
||||
|
||||
assert not should_alert(status, None)
|
||||
Reference in New Issue
Block a user