[FIX] bus: fix bus test undeterministic runbot error

Before this commit, the bus service test "tabs share message from a
channel" was sometimes failing. This is due to the fact that it was
only waiting a `nextTick` to receive the message but the message is
not guaranteed to arrive within a tick. Indeed, the message is first
sent from the worker `MessagePort` via `postMessage` then triggered
on the event bus via `dispatchEvent`.

closes odoo/odoo#113008

X-original-commit: a8d25a89a9fbdb9d51926df2c33c1f4b5eba9b3f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
This commit is contained in:
tsm-odoo
2023-02-18 02:49:48 +01:00
parent 5b4da6ae73
commit f95c95b44f
+3
View File
@@ -140,6 +140,9 @@ QUnit.module('Bus', {
slaveEnv.services['bus_service'].addChannel('lambda');
pyEnv['bus.bus']._sendone('lambda', 'notifType', 'beta');
// Wait one tick for the worker `postMessage` to reach the bus_service.
await nextTick();
// Wait another tick for the `bus.trigger` to reach the listeners.
await nextTick();
assert.deepEqual(