Refactor/reconsider the slowest tests

RESOLVED FIXED

Status

Webtools
Air Mozilla
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: peterbe, Assigned: peterbe)

Tracking

Trunk
x86
Mac OS X

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

3 years ago
Some tests are MUCH slower than the rest. We currently have ~550 integration tests (aka django unit tests). 
The top 10 slowest tests take up 38% of the total time it takes to run all tests. 

Used nose-timer (https://github.com/mahmoudimus/nose-timer/) and ran the tests over and over and then analyzed the timings. The top 10 slowest tests are:

manage.tests.views.test_vidlymedia.TestVidlyMedia.test_vidly_media               1.46 3.013 %
manage.tests.views.test_approvals.TestApprovals.test_approval_reconsider         1.42 2.93 %
uploads.tests.test_views.TestUploads.test_save_on_an_active_event_edit           1.34 2.752 %
manage.tests.views.test_vidlymedia.TestVidlyMedia.test_vidly_media_with_status   1.31 2.706 %
manage.tests.views.test_participants.TestParticipants.test_participant_pages     0.78 1.602 %
comments.tests.test_views.TestComments.test_basic_event_data                     0.76 1.574 %
main.tests.test_views.TestEventEdit.test_edit_recruitmentmessage                 0.48 0.987 %
main.tests.test_views.TestPages.test_picture_over_placeholder                    0.47 0.972 %
manage.tests.views.test_events.TestEvents.test_overwrite_old_slug                0.46 0.943 %
test_views.TestRoku.test_event_duration                                          0.44 0.912 %

It's these that take up about 40% of the whole time. 

I suspect much of the problem lies with depending on `cache.clear()` in the `tearDown()` method.
(Assignee)

Comment 1

3 years ago
Gah! I copied the wrong number. It's not 38% of the total time. It's 18%. You can see that by summing the percentage column on the right for those top 10. Still a pretty big number.
(Assignee)

Comment 2

3 years ago
With https://github.com/mozilla/airmozilla/pull/184 when I run the tests now the top 10 slowest tests look like this now::

airmozilla.comments.tests.test_views.TestComments.test_basic_event_data: 0.7924s
test_views.TestRoku.test_event_duration: 0.4506s
airmozilla.main.tests.test_views.TestEventEdit.test_edit_recruitmentmessage: 0.4171s
airmozilla.main.tests.test_views.TestPages.test_picture_over_placeholder: 0.3831s
airmozilla.manage.tests.views.test_events.TestEvents.test_overwrite_old_slug: 0.3731s
test_views.TestRoku.test_channel_feed: 0.3397s
airmozilla.manage.tests.views.test_usersandgroups.TestUsersAndGroups.test_group_edit: 0.3067s
airmozilla.main.tests.test_views.TestPages.test_executive_summary: 0.2801s
airmozilla.manage.tests.views.test_dashboard.TestDashboard.test_dashboard_data: 0.2794s
airmozilla.manage.tests.views.test_discussionsandcomments.TestDiscussionAndComments.test_create_discussion: 0.2776s

Their total is now 3.9 seconds out of the new total of 55.6 seconds. So the top 10 only take 7%.
Assignee: nobody → peterbe
Status: NEW → ASSIGNED
(Assignee)

Comment 4

3 years ago
I'm going to call this done because it has been addressed after all and elsewise the bug would never be closeable.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED

Updated

3 years ago
Depends on: 1223840

Updated

3 years ago
No longer depends on: 1223840

Updated

3 years ago
Depends on: 1223871

Updated

3 years ago
No longer depends on: 1223871
You need to log in before you can comment on or make changes to this bug.