Skip to content

Speedup tests use DatabaseTransaactions where applicable #1148

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

Closed
wants to merge 1 commit into from

Conversation

apmedev
Copy link

@apmedev apmedev commented Oct 4, 2024

#986

Parallel to the main branch fails.
Profiling on the main branch fails and is super slow. The reason are the queries in certain tests.
I created a testing database and provided users with access.

Changes:

  1. Database Transactions will wrap each test in a transaction, rolling back changes after the test.
  2. Create testing env example
  3. Try in-memory SQLite for testing
  4. Update .gitignore

Running profiling the following results: vendor/bin/pest --profile
Old result:

  • Tests: 318 passed (606 assertions)
  • Duration: 515.68s

New Result:

  • Tests: 318 passed (606 assertions)
  • Duration: 165.94s

Parallel on my branch still is not passing tests.
So I can't verify the following: data changes in one process aren't visible to another until the transaction is committed. As a result, processes running in parallel can't reliably see each other's data.
Running

@apmedev apmedev changed the title Use DatabaseTransaactions where applicable Speedup tests use DatabaseTransaactions where applicable Oct 4, 2024
@driesvints
Copy link
Member

Heya! Thank you so much for your PR. Your PR actually gave me an idea and I flipped the switch on parallel testing here in CI which brought the running time even further down than moving to transactions. So thank you for moving me into that direction! While I can't merge this PR anymore now this did help out!

@driesvints driesvints closed this Oct 9, 2024
@apmedev
Copy link
Author

apmedev commented Oct 10, 2024

Hi !

This is my first try at contributing, do you have any other tasks that are open. Since the issues I see seem already ongoing. I'm not sure how my commit contributed, but I'm happy that it did. So I if you have any other task, feel free to share, and I can give it a shot. Sadly, I was not able to get the parallel testing pass.

@apmedev apmedev deleted the improve_testing_speed_#986 branch October 10, 2024 13:43
@apmedev apmedev restored the improve_testing_speed_#986 branch October 10, 2024 13:43
@driesvints
Copy link
Member

Heya, not right now but keep an eye out on the issue tracker when we add more issues with "help wanted". Your help is greatly appreciated, thanks! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants