Skip to content

Speed up the custom ability specs

What does this MR do and why?

This change speeds up the time necessary for the Custom Ability specs to run. In order to speed up the tests I moved any tests that aren't specific to the custom abilities config files out of the table tests and into a separate context to test different levels of the hierarchy with a single specific arbitrary custom permission. I was able to reduce the total time from approximately 10 minutes down to approximately 1 minute. There is probably still more room for improvement but hopefully this is a reasonable start.

#473528 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before:

time bundle exec rspec ee/spec/models/authz/custom_ability_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 1.016163056 seconds
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 9 minutes 35 seconds (files took 33.37 seconds to load)
4422 examples, 0 failures

Randomized with seed 7993

[TEST PROF INFO] Time spent in factories: 06:10.056 (61.99% of total time)

real    10m9.523s
user    8m36.940s
sys     0m19.988s

After:

time bundle exec rspec ee/spec/models/authz/custom_ability_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Test environment set up in 0.98138903 seconds
......................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 1 minute 10.11 seconds (files took 12.73 seconds to load)
438 examples, 0 failures

Randomized with seed 21750

[TEST PROF INFO] Time spent in factories: 00:40.725 (55.33% of total time)

real    1m24.181s
user    1m9.530s
sys     0m5.531s
Edited by mo khan

Merge request reports

Loading