Skip to content

Speed-up tree reorder epic specs by using aggregate_failures

Peter Leitzen requested to merge pl-spec-fast-tree-reorder-epics into master

What does this MR do and why?

This MR improves the speed of ee/spec/services/epics/tree_reorder_service_spec.rb by using :aggregate_failures.

It also:

  • Fixes all remaining 👮 offenses
  • Ensure that the spec can be run in random order

See individual commit message for details.

How to set up and validate locally

bin/rspec ee/spec/services/epics/tree_reorder_service_spec.rb

RSpec Profiling

Here's the output from test-prof when run with FPROF=1. Note:

  • Total amount of factories created went down from 587 to 242 🚀
  • Total events went down from 13952 to 6472
  • Queries saved: 7480

Before

Finished in 1 minute 5.13 seconds (files took 13.33 seconds to load)
90 examples, 0 failures

Randomized with seed 31962

[TEST PROF INFO] Time spent in factories: 00:30.643 (45.2% of total time)
[TEST PROF INFO] Factories usage

 Total: 587
 Total top-level: 338
 Total time: 00:30.643 (out of 01:15.528)
 Total uniq factories: 12

   total   top-level     total time      time per call      top-level time               name

     226         226       26.6220s            0.1178s            26.6220s               epic
     226           0       19.1435s            0.0847s             0.0000s             author
      96          96        0.9057s            0.0094s             0.9057s         epic_issue
       8           8        0.7310s            0.0914s             0.7310s              group
       8           0        0.0454s            0.0057s             0.0000s namespace_settings
       8           0        0.0400s            0.0050s             0.0000s namespace_ci_cd_settings
       4           4        0.4277s            0.1069s             0.4277s              issue
       4           0        0.0271s            0.0068s             0.0000s     work_item_type
       2           1        0.8745s            0.4373s             0.6405s               user
       2           2        1.3031s            0.6516s             1.3031s            project
       2           0        0.2621s            0.1311s             0.0000s          namespace
       1           1        0.0138s            0.0138s             0.0138s            license

After

Finished in 31.23 seconds (files took 10.99 seconds to load)
34 examples, 0 failures

Randomized with seed 5245

[TEST PROF INFO] Time spent in factories: 00:12.675 (37.54% of total time)
[TEST PROF INFO] Factories usage

 Total: 242
 Total top-level: 137
 Total time: 00:12.675 (out of 00:40.750)
 Total uniq factories: 12

   total   top-level     total time      time per call      top-level time               name

      88          88        9.7863s            0.1112s             9.7863s               epic
      88           0        7.2291s            0.0821s             0.0000s             author
      36          36        0.4491s            0.0125s             0.4491s         epic_issue
       5           5        0.4210s            0.0842s             0.4210s              group
       5           0        0.0248s            0.0050s             0.0000s namespace_settings
       5           0        0.0218s            0.0044s             0.0000s namespace_ci_cd_settings
       4           4        0.4827s            0.1207s             0.4827s              issue
       4           0        0.0302s            0.0076s             0.0000s     work_item_type
       2           1        0.4682s            0.2341s             0.4143s               user
       2           2        1.1097s            0.5549s             1.1097s            project
       2           0        0.1336s            0.0668s             0.0000s          namespace
       1           1        0.0128s            0.0128s             0.0128s            license

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports