Skip to content

Improves groups controller specs

What does this MR do and why?

Improves groups controller specs using let_it_be instead of let.

Changelog: performance

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

[TEST PROF INFO] Time spent in factories: 01:04.680 (35.31% of total time)
[TEST PROF INFO] Factories usage

 Total: 1125
 Total top-level: 513
 Total time: 01:04.680 (out of 03:12.616)
 Total uniq factories: 14

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

     448         218       19.1127s            0.0427s             9.3906s               user
     137          59       18.0729s            0.1319s            14.0642s            cluster
     104         104       33.8241s            0.3252s            33.8241s            project
     104           0        9.7167s            0.0934s             0.0000s          namespace
      61          61        5.5279s            0.0906s             5.5279s              group
      61           0        0.3277s            0.0054s             0.0000s namespace_settings
      61           0        0.2209s            0.0036s             0.0000s namespace_ci_cd_settings
      42          42        1.1475s            0.0273s             1.1475s          milestone
      42           0        2.2416s            0.0534s             0.0000s cluster_provider_gcp
      36           0        5.2665s            0.1463s             0.0000s cluster_platform_kubernetes
      14          14        0.5744s            0.0410s             0.5744s              admin
      11          11        0.1016s            0.0092s             0.1016s cluster_kubernetes_namespace
       3           3        0.0232s            0.0077s             0.0232s            license
       1           1        0.0269s            0.0269s             0.0269s  oauth_application

Now

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

 Total: 403
 Total top-level: 161
 Total time: 00:16.083 (out of 02:16.087)
 Total uniq factories: 14

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

     158          56        6.6986s            0.0424s             2.6326s               user
      97          39       11.6822s            0.1204s             9.0539s            cluster
      32          32        0.9487s            0.0296s             0.9487s          milestone
      32           0        1.6030s            0.0501s             0.0000s cluster_provider_gcp
      26           0        3.1356s            0.1206s             0.0000s cluster_platform_kubernetes
      14          14        0.5613s            0.0401s             0.5613s              admin
       9           9        0.8486s            0.0943s             0.8486s              group
       9           0        0.0271s            0.0030s             0.0000s namespace_ci_cd_settings
       9           0        0.0576s            0.0064s             0.0000s namespace_settings
       6           6        1.9808s            0.3301s             1.9808s            project
       6           0        0.4928s            0.0821s             0.0000s          namespace
       3           3        0.0205s            0.0068s             0.0205s            license
       1           1        0.0148s            0.0148s             0.0148s cluster_kubernetes_namespace
       1           1        0.0227s            0.0227s             0.0227s  oauth_application

How to set up and validate locally

  1. Checkout the branch
  2. Execute the following command!
FPROF=1 bundle exec rspec spec/controllers/groups/settings/applications_controller_spec.rb spec/controllers/groups/clusters_controller_spec.rb spec/controllers/groups/milestones_controller_spec.rb
  1. Verify that specs are running as expected 🎉
Edited by Bojan Marjanovic

Merge request reports

Loading