Allow WS queue to temporarily peak (#34175)
* Allow WS queue to temporarily peak * Remove unused code
This commit is contained in:
parent
dbcc294d67
commit
bea354b82a
6 changed files with 116 additions and 34 deletions
|
@ -2,19 +2,11 @@
|
|||
from unittest.mock import Mock, patch
|
||||
|
||||
from aiohttp import WSMsgType
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.websocket_api import const, messages
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_low_queue():
|
||||
"""Mock a low queue."""
|
||||
with patch("homeassistant.components.websocket_api.http.MAX_PENDING_MSG", 5):
|
||||
yield
|
||||
|
||||
|
||||
async def test_invalid_message_format(websocket_client):
|
||||
"""Test sending invalid JSON."""
|
||||
await websocket_client.send_json({"type": 5})
|
||||
|
@ -46,14 +38,6 @@ async def test_quiting_hass(hass, websocket_client):
|
|||
assert msg.type == WSMsgType.CLOSE
|
||||
|
||||
|
||||
async def test_pending_msg_overflow(hass, mock_low_queue, websocket_client):
|
||||
"""Test get_panels command."""
|
||||
for idx in range(10):
|
||||
await websocket_client.send_json({"id": idx + 1, "type": "ping"})
|
||||
msg = await websocket_client.receive()
|
||||
assert msg.type == WSMsgType.close
|
||||
|
||||
|
||||
async def test_unknown_command(websocket_client):
|
||||
"""Test get_panels command."""
|
||||
await websocket_client.send_json({"id": 5, "type": "unknown_command"})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue