Skip to content

Commit

Permalink
[FIX] base: cron indeterministic test
Browse files Browse the repository at this point in the history
Upon calling `invalidate_recordset` the current recordset present is
flushed. That recordset can be active=True which override active=False
set `_process_job()`. Flushing the recordset *before* calling
`_process_job` makes sure that there is no dangling data to be flushed.

closes #159262

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
  • Loading branch information
Julien00859 committed Mar 26, 2024
1 parent e114934 commit bfc62bc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions odoo/addons/base/tests/test_ir_cron.py
Expand Up @@ -263,6 +263,7 @@ def test_cron_process_job(self):

def test_cron_null_interval(self):
self.cron.interval_number = 0
self.cron.flush_recordset()
with self.assertLogs('odoo.addons.base.models.ir_cron', 'ERROR'):
self.cron._process_job(get_db_name(), self.env.cr, self.cron.read(load=False)[0])
self.cron.invalidate_recordset(['active'])
Expand Down

0 comments on commit bfc62bc

Please sign in to comment.