forked from phoenix/litellm-mirror
test(test_alerting.py): fix test
This commit is contained in:
parent
01adeda2e4
commit
dde6af7420
1 changed files with 2 additions and 7 deletions
|
@ -576,9 +576,7 @@ async def test_outage_alerting_called(
|
||||||
slack_alerting.update_values(llm_router=router)
|
slack_alerting.update_values(llm_router=router)
|
||||||
with patch.object(
|
with patch.object(
|
||||||
slack_alerting, "outage_alerts", new=AsyncMock()
|
slack_alerting, "outage_alerts", new=AsyncMock()
|
||||||
) as mock_outage_alert, patch.object(
|
) as mock_outage_alert:
|
||||||
slack_alerting, "region_outage_alerts", new=AsyncMock()
|
|
||||||
) as mock_region_alert:
|
|
||||||
try:
|
try:
|
||||||
await router.acompletion(
|
await router.acompletion(
|
||||||
model=model,
|
model=model,
|
||||||
|
@ -589,7 +587,6 @@ async def test_outage_alerting_called(
|
||||||
pass
|
pass
|
||||||
|
|
||||||
mock_outage_alert.assert_called_once()
|
mock_outage_alert.assert_called_once()
|
||||||
mock_region_alert.assert_called_once()
|
|
||||||
|
|
||||||
with patch.object(slack_alerting, "send_alert", new=AsyncMock()) as mock_send_alert:
|
with patch.object(slack_alerting, "send_alert", new=AsyncMock()) as mock_send_alert:
|
||||||
for _ in range(6):
|
for _ in range(6):
|
||||||
|
@ -603,9 +600,7 @@ async def test_outage_alerting_called(
|
||||||
pass
|
pass
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
if error_code == 500 or error_code == 408:
|
if error_code == 500 or error_code == 408:
|
||||||
assert (
|
mock_send_alert.assert_called_once()
|
||||||
mock_send_alert.assert_called_once()
|
|
||||||
) # only model alert. region alert should only trigger for 2+ models in same region
|
|
||||||
else:
|
else:
|
||||||
mock_send_alert.assert_not_called()
|
mock_send_alert.assert_not_called()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue