From 60c1867a443663c19ac5f9a961427dc4c10c6b65 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 23 May 2022 19:14:04 -0400 Subject: [PATCH] async sleep and require connection reset error for DoS test (#11612) --- tests/core/server/test_dos.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/core/server/test_dos.py b/tests/core/server/test_dos.py index de87635e356c..a8c369612619 100644 --- a/tests/core/server/test_dos.py +++ b/tests/core/server/test_dos.py @@ -201,8 +201,10 @@ async def test_spam_tx(self, setup_two_nodes_fixture, self_hostname): # Remove outbound rate limiter to test inbound limits ws_con.outbound_rate_limiter = RateLimiter(incoming=True, percentage_of_limit=10000) - for i in range(6000): - await ws_con._send_message(new_tx_message) + with pytest.raises(ConnectionResetError): + for i in range(6000): + await ws_con._send_message(new_tx_message) + await asyncio.sleep(0) await asyncio.sleep(1) def is_closed():