[FIX] bus: solve indeterministic error in TestWebsocketCaryall

This PR fixes the `15350`runbot issue that was due to the
websocket subscribe not being properly awaited before logging
out.When the log out occurred before the subscribe was received,
the `odoo_ws` variable was `None`.

closes odoo/odoo#118097

X-original-commit: 59af91840c3ed7253c1c3c9dd80a4919ebdee593
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
tsm-odoo
2023-04-07 21:48:48 +02:00
parent 34149617a3
commit c0ce422935
+1 -1
View File
@@ -148,11 +148,11 @@ class TestWebsocketCaryall(WebsocketCase):
'event_name': 'subscribe',
'data': {'channels': ['channel1'], 'last': 0}
}))
subscribe_done_event.wait(timeout=5)
self.url_open('/web/session/logout')
# Simulate postgres notify. The session with whom the websocket
# connected has been deleted. WebSocket should be closed without
# receiving the message.
subscribe_done_event.wait(timeout=5)
self.env['bus.bus']._sendone('channel1', 'notif type', 'message')
odoo_ws.trigger_notification_dispatching()
self.assert_close_with_code(websocket, CloseCode.SESSION_EXPIRED)