Skip to content

Commit 213273f

Browse files
Reduce admin test timeouts to reduce random failures
1 parent 36a8922 commit 213273f

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

tests/async/test_admin.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def with_instrumented_server(auth=False, **ikwargs):
2121
def decorator(f):
2222
@wraps(f)
2323
def wrapped(self, *args, **kwargs):
24-
sio = socketio.AsyncServer(async_mode='asgi')
24+
sio = socketio.AsyncServer(async_mode='asgi', ping_interval=1,
25+
ping_timeout=1)
2526

2627
@sio.event
2728
async def enter_room(sid, data):
@@ -201,10 +202,10 @@ def test_admin_connect_only_admin(self):
201202

202203
@with_instrumented_server()
203204
def test_admin_connect_with_others(self):
204-
with socketio.SimpleClient() as client1, \
205-
socketio.SimpleClient() as client2, \
206-
socketio.SimpleClient() as client3, \
207-
socketio.SimpleClient() as admin_client:
205+
with socketio.SimpleClient(reconnection=False) as client1, \
206+
socketio.SimpleClient(reconnection=False) as client2, \
207+
socketio.SimpleClient(reconnection=False) as client3, \
208+
socketio.SimpleClient(reconnection=False) as admin_client:
208209
client1.connect('http://localhost:8900')
209210
client1.emit('enter_room', 'room')
210211
sid1 = client1.sid

tests/common/test_admin.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def with_instrumented_server(auth=False, **ikwargs):
1818
def decorator(f):
1919
@wraps(f)
2020
def wrapped(self, *args, **kwargs):
21-
sio = socketio.Server(async_mode='threading')
21+
sio = socketio.Server(async_mode='threading', ping_interval=1,
22+
ping_timeout=1)
2223

2324
@sio.event
2425
def enter_room(sid, data):
@@ -177,10 +178,10 @@ def test_admin_connect_only_admin(self):
177178

178179
@with_instrumented_server()
179180
def test_admin_connect_with_others(self):
180-
with socketio.SimpleClient() as client1, \
181-
socketio.SimpleClient() as client2, \
182-
socketio.SimpleClient() as client3, \
183-
socketio.SimpleClient() as admin_client:
181+
with socketio.SimpleClient(reconnection=False) as client1, \
182+
socketio.SimpleClient(reconnection=False) as client2, \
183+
socketio.SimpleClient(reconnection=False) as client3, \
184+
socketio.SimpleClient(reconnection=False) as admin_client:
184185
client1.connect('http://localhost:8900')
185186
client1.emit('enter_room', 'room')
186187
sid1 = client1.sid

0 commit comments

Comments
 (0)