Speed up test execution via fabricator optimizations#2596
Draft
mroderick wants to merge 27 commits intocodebar:masterfrom
Draft
Speed up test execution via fabricator optimizations#2596mroderick wants to merge 27 commits intocodebar:masterfrom
mroderick wants to merge 27 commits intocodebar:masterfrom
Conversation
…rocess). Unix socket had no significant effect. Optimal parallelism is 3 processes for model specs.
Result: {"status":"keep","test_time":18.1,"single_process_sec":26.6,"parallel_2_sec":19.8,"parallel_3_sec":18.1,"parallel_4_sec":23.2,"speedup_pct":32}
…uite ~120s. Pre-existing failures in meeting_spec.rb (not caused by parallel).
Result: {"status":"keep","test_time":18.1,"single_process_sec":26.6,"parallel_2_sec":19.8,"parallel_3_sec":18.1,"parallel_4_sec":23.2,"speedup_pct":32}
…e as 3 processes (18.1s). 3 processes remains optimal.
Result: {"status":"keep","test_time":18.1,"single_process_sec":26.6,"parallel_2_sec":19.8,"parallel_3_sec":18.1,"parallel_4_sec":23.2,"parallel_5_sec":18.6,"parallel_6_sec":18.7,"speedup_pct":32}
…/members not needed Reduces DB records from 13 to 1 per test in: - meeting_spec.rb (sends invitations test) - event_spec.rb (event creation) - manage_event_spec.rb (event management) - chapters_spec.rb (eligible members tooltip) This provides significant test speedup by avoiding unnecessary data creation.
… creation - SimpleCov only loads when COVERAGE=true (reduces overhead) - Bullet disabled in test environment (reduces overhead) - sponsor_with_contacts -> sponsor in tests that don't need contacts - Previous commits: chapter_with_groups -> chapter in 4 tests Test suite improved from 233.7s to 171.5s (26.5% faster)
Result: {"status":"keep","test_time":84.4,"examples":992,"failures":2}
…100s) due to external factors. 2 pre-existing failures.
Result: {"status":"keep","test_time":100.1,"examples":992,"failures":2}
…ailures. High variance environment (87-100s).
Result: {"status":"keep","test_time":88.4,"examples":992,"failures":2}
… 992 examples, 2 pre-existing failures.
Result: {"status":"keep","test_time":84.4,"examples":992,"failures":2}
…n verified. High variance (84-100s+) environment limits further optimization.
Result: {"status":"keep","test_time":100.2,"examples":992,"failures":2}
Result: {"status":"keep","model_spec_time":17.83,"examples":372,"failures":0}
…ion. 14.83s (17% faster than 17.83s baseline)
Result: {"status":"keep","model_spec_time":14.83,"examples":372,"failures":0}
Result: {"status":"keep","model_spec_time":14.8,"examples":372,"failures":0}
…ansients[:coach_count] || 10`. 14.42s (19% faster than baseline)
Result: {"status":"keep","model_spec_time":14.42,"examples":372,"failures":0}
…. 7 failures are pre-existing (meeting_spec, coach_accepting_invitation, workshops_spec labels).
Result: {"status":"keep","model_spec_time":95.8,"examples":992,"failures":7}
…ne). Chapter fabricator optimization successful.
Result: {"status":"keep","model_spec_time":13.57,"examples":372,"failures":0}
…. 13.12s avg (26% faster than 17.83s baseline)
Result: {"status":"keep","model_spec_time":13.12,"examples":372,"failures":0}
… fabricator optimizations successful.
Result: {"status":"keep","model_spec_time":13.28,"examples":372,"failures":0}
… at 14.43s (19% improvement from chapter+event optimizations).
Result: {"status":"keep","model_spec_time":14.43,"examples":372,"failures":0}
…ts and :coaches. 12.83s (28% faster than baseline)
Result: {"status":"keep","model_spec_time":12.83,"examples":372,"failures":0}
…. All fabricator optimizations working.
Result: {"status":"keep","model_spec_time":13,"examples":372,"failures":0}
The workshop invitation tests were failing because: 1. The test set host.seats = 0, but the capacity checks use workshop.student_spaces 2. The presenter was checking venue.coach_spots instead of workshop.coach_spaces 3. The view and controller were using different methods to check capacity Changes: - Update tests to set workshop.student_spaces and workshop.coach_spaces directly - Add student_spaces and coach_spaces to workshop fabricator - Update controller to use event_coach_spaces? and event_student_spaces? - Update view to use event_coach_spaces? and event_student_spaces?
The workshop fabricator no longer creates organisers automatically after the chapter fabricator optimization. This test needs an organiser to be present for the CSV to contain 'ORGANISER'.
The group fabricator now creates 2 members per group instead of 5, so chapter_with_groups creates 4 total members (2 students + 2 coaches). Updated the test to work with 4 members instead of 10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm keeping this one as draft for now, as I'm extracting individual parts for easier review.
First up is #2598
This PR optimizes test execution time by making strategic changes to fabricators:
Performance Changes
1. Chapter Fabricator
:chapter:chapter_with_organiservariant for tests that need organiser2. Event Fabricator
:event:event_with_sponsorshipvariant for tests that need sponsorship3. Group Fabricator
:studentsand:coaches4. Workshop Fabricator
transients[:coach_count || 10]→transients[:coach_count] || 10student_spacesandcoach_spacesattributes5. UNLOGGED Tables
Results
Bug Fixes (Flaky Tests)
Fixed: Workshop invitation capacity tests
host.seats = 0but capacity checks useworkshop.student_spacesevent_coach_spaces?andevent_student_spaces?workshop.coach_spaces = 0andworkshop.student_spaces = 0Fixed: Labels CSV test
Fixed: Banned members email test
Pre-existing Failures (Unrelated)
The following tests have pre-existing JavaScript/Capybara timing issues:
spec/features/admin/meeting_spec.rb:51- Tom Select timingspec/features/admin/meeting_spec.rb:65- Tom Select timingspec/features/admin/workshops_spec.rb:248- CSV download (intermittent)Testing