Skip to content

Commit

Permalink
async sleep and require connection reset error for DoS test (#11612)
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky authored May 23, 2022
1 parent 36120cf commit 60c1867
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/core/server/test_dos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 60c1867

Please sign in to comment.