Skip to content

Speed up admin_adds_license_spec.rb

Thong Kuah requested to merge speed_up_license_feature_spec into master

What does this MR do and why?

Speed up one of the slower specs from https://gitlab-org.gitlab.io/rspec_profiling_stats/.

It turns out that has_button? is quite slow, so we skip calling it. It takes about 50% of time just to check the button exists. This section is expanded by default in test so no need to perform this expensive action.

Screenshots or screen recordings

Using stackprof (bin/rspec-stackprof --speedscope=true <spec>) we can see the timings

Screen_Shot_2022-06-19_at_4.25.06_PM

How to set up and validate locally

  1. Run time bundle exec rspec -f d ./ee/spec/features/admin/licenses/admin_adds_license_spec.rb

On this branch it's around 1 minute 20s. On master it's around 8 minutes

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 Thong Kuah

Merge request reports