From f95c95b44f9dee58bde80f1a945d719310a146e6 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Fri, 17 Feb 2023 07:56:54 +0000 Subject: [PATCH] [FIX] bus: fix bus test undeterministic runbot error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Signed-off-by: Stockbauer Matthieu (tsm) --- addons/bus/static/tests/bus_tests.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/bus/static/tests/bus_tests.js b/addons/bus/static/tests/bus_tests.js index e16ffa2c125..2691dce2aa0 100644 --- a/addons/bus/static/tests/bus_tests.js +++ b/addons/bus/static/tests/bus_tests.js @@ -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(