-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Fix tests to reduce chance of 'database is locked' error. #4651 #4677
base: main
Are you sure you want to change the base?
Conversation
I decided to create my own marker Let me know your considerations, as I don't want to add bloat code. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've set the tests to run, but... I think if we're going to do a retry, we should be doing it in cve-bin-tool itself, not only the test suite. Could you look into moving your code there?
Hi Terri, when you say
do you mean removing the retry logic from the tests entirely and implementing it solely in the core |
The former: there should be no retry at all in the tests because the retry will be handled in the code (probably in That suggests another usability improvement: if we do exceed the retries and finally time out, we should have the final error specifically suggest to people that they use Thanks for clarifying! |
I’ve really missed contributing, and I’m happy to be back after a long journey over the past couple of months! Looking forward to your suggestions to sort this one out so I can move on to the next task. Also excited to join the GSoC 2025 meeting when it comes up and learn more about it! |
I resolved the merge conflicts and have set the tests to run again, but I think we're close to being able to merge this. |
Hi, @giacob500. It looks like you are using a new library. Please don't forget to add it to requirements.txt |
Hey @giacob500 are you still working on this issue? |
Hi, yes I am still working on it... a bit busy with work but I'd like to get to the bottom of it. Thanks for asking, I will keep you in mind if I need a hand! |
@terriko Apologies, please ignore the review request above. I misclicked it |
@terriko Hi, I am a bit confused here... Based on the screenshot below you have proposed some changes and I have to approve them? Or the opposite?
as suggested by @fil1n in a previous comment, then commit. |
This pull request addresses and improves the stability of the tests related to database access, specifically targeting the
database is locked
error in SQLite. The error typically occurs when database operations are attempted simultaneously, leading to contention and test failures.Key Changes:
execute_with_retry
to gracefully handle SQLite database lock errors. This function retries the query a few times with a short delay before failing, reducing the chance of encountering lock issues.test_import_export_json
), calls to the database now utilize the retry logic to ensure smooth execution even in the event of temporary locking.synchronous
group to ensure that they run without asynchronous-related issues.These improvements should help reduce flakiness in the test suite, particularly for long-running tests interacting with the SQLite database.
Related Issue: