Skip to content

Conversation

@sbidoul
Copy link
Member

@sbidoul sbidoul commented Mar 3, 2025

FW port of #748 + #816

@OCA-git-bot
Copy link
Contributor

Hi @guewen,
some modules you are maintaining are being modified, check this out!

@sbidoul sbidoul force-pushed the 18.0-748-port branch 2 times, most recently from 11688d3 to 58bf17f Compare March 3, 2025 17:49
@hbrunn
Copy link
Member

hbrunn commented Mar 21, 2025

@sbidoul looks like you have to rewrite this to use savepoints?

@sbidoul
Copy link
Member Author

sbidoul commented Mar 21, 2025

I'm note sure it's possible to test that with savepoints, since we test database locks.

@AnizR

self.assertEqual(1, len(locks))

# commit to update queue_job records in DB
self.env.cr.commit() # pylint: disable=E8102
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnizR in this test, is it necessary to commit?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise, the row representing a 'lock' will not be created within the db

job_obj.set_started()

job_obj.store()
self.env.cr.commit() # pylint: disable=E8102
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we could maybe create a job with demo data, and run this test post install.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using data to create some records within the db might be a way to avoid to commit within tests, I'll think about it 👍

WHERE
module='queue_job'
AND model='ir.cron'
AND name='ir_cron_queue_job_garbage_collector'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may directly want to consider this fix: 46b0d8f

@AnizR AnizR force-pushed the 18.0-748-port branch 2 times, most recently from 42a1df0 to f64b966 Compare June 2, 2025 15:08
@rousseldenis rousseldenis added this to the 18.0 milestone Jun 2, 2025
@AnizR
Copy link
Contributor

AnizR commented Jun 2, 2025

@hbrunn, I came up with the solution of loading test queue.job records within demo.

What do you think about it?

@AnizR AnizR force-pushed the 18.0-748-port branch 2 times, most recently from 5fd02bb to dca717b Compare June 3, 2025 14:11
model="queue.job"
eval="('test_enqueued_job',)"
/>
</odoo>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnizR this file should be removed as it was moved to test_queue_job?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, well spotted!

Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Remember to merge w/ nobump.

@sbidoul sbidoul marked this pull request as draft August 20, 2025 09:04
@sbidoul
Copy link
Member Author

sbidoul commented Aug 20, 2025

Setting as draft. There is a conflicts and the tests need some rework.

AnizR and others added 5 commits September 15, 2025 10:11
…eue jobs in timeout

[IMP] queue_job: increment 'retry' when re-queuing job that have been killed
A model is better than a manually managed table as it will
protect the table from deletion by database_cleanup.
@AnizR
Copy link
Contributor

AnizR commented Sep 15, 2025

I reworked the tests and decided to isolate the tests in test_queue_job.
Moreover, I managed to remove the .commit() calls.

Copy link
Member

@FrancoMaxime FrancoMaxime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: code review

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@sbidoul sbidoul marked this pull request as ready for review September 17, 2025 14:57
@sbidoul
Copy link
Member Author

sbidoul commented Sep 17, 2025

/ocabot merge major

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 18.0-ocabot-merge-pr-749-by-sbidoul-bump-major, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at c6f5ba8. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit b4c689d into OCA:18.0 Sep 17, 2025
7 checks passed
@sbidoul sbidoul deleted the 18.0-748-port branch September 17, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants