Ticket #868 (closed enhancement: fixed)
Test improvements
Reported by: | thejimmyg | Owned by: | sebbacon |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | ckan | Keywords: | |
Cc: | Repository: | ||
Theme: |
Description
The tests currently take 41 mins to run on most laptops. This slows down development and discourages a test-driven approach.
We'd like to see the tests pass in 5 mins or less (but anything would be an improvement!)
Some suggestions for achieving this include:
- Upgrading the entire codebase to SQLAlchemy 0.6 so that tests could run against an in-memory SQLite database
- Not setting up and tearing down the database so frequently.
Attachments
Change History
comment:2 Changed 3 years ago by sebbacon
- Owner changed from thejimmyg to sebbacon
See also #867
Thanks for the patch.
Changed 3 years ago by kindly@…
- Attachment ckan test speed times after 0.5 upgrade.csv added
speed per test after 0.57 upgrade
comment:4 Changed 3 years ago by anonymous
Attached are the timings I have for the tests after I upgraded to 0.57 and after a few simple test tweaks. They do not include setup and teardown time at the class level as they are not assignable to individual tests.
Changed 3 years ago by kindly@…
- Attachment no_autoflush_deletes.diff added
This is a patch so that we do not need to monkeypatch sqlalchemy dialects
Changed 3 years ago by kindly@…
- Attachment vdm_purge_no_autoflush.diff added
This is the corrisponding patch for the vdm, so we dont need to monkeypatch sqlalchemy
Changed 3 years ago by kindly@…
- Attachment postgres_speed.diff added
Speed up postgres by making sure postgres does not drop and reacreate each time.
comment:5 Changed 3 years ago by dread
- Status changed from new to closed
- Resolution set to fixed
I've merged in David Raznick's patches:
- no_autoflush_deletes.diff cset:2b9591172182
- postgres_speed.diff cset:fa1b7e3a4e0f
- vdm_purge_no_autoflush.diff vdm cset 8accdd0b9b7f
I've also merged in Seb's fork: cset:68d63fda4814 which closes this ticket, achieving test speeds of under 3 minutes!
Below is a patch to make the tests run at least 2.5 times faster (about 15 mins on my old laptop). Instead of dropping the tables each time, it just deletes everything in them, using a low level connection. All the tests pass this way. It's a surprisingly clean patch. Here are a few points concerning it.