Skip to content

Improve ServiceHook and SystemHook specs

Bojan Marjanovic requested to merge bojan/improve-hook-specs into master

What does this MR do and why?

It this MR we're improving ServiceHook and SystemHook specs performance 🚀

In total, we should save up to 40 seconds of the pipeline.

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

  • service_hook_spec.rb
[TEST PROF INFO] Time spent in factories: 00:27.220 (56.18% of total time)
[TEST PROF INFO] Factories usage

 Total: 260
 Total top-level: 70
 Total time: 00:27.220 (out of 00:58.166)
 Total uniq factories: 6
  • system_hook_spec.rb
[TEST PROF INFO] Time spent in factories: 00:07.899 (22.94% of total time)
[TEST PROF INFO] Factories usage

 Total: 86
 Total top-level: 77
 Total time: 00:07.899 (out of 00:44.072)
 Total uniq factories: 9

After

  • service_hook_spec.rb
[TEST PROF INFO] Time spent in factories: 00:01.165 (4.49% of total time)
[TEST PROF INFO] Factories usage

 Total: 8
 Total top-level: 7
 Total time: 00:01.165 (out of 00:36.487)
 Total uniq factories: 6
  • system_hook_spec.rb
[TEST PROF INFO] Time spent in factories: 00:01.865 (6.84% of total time)
[TEST PROF INFO] Factories usage

 Total: 23
 Total top-level: 14
 Total time: 00:01.865 (out of 00:37.877)
 Total uniq factories: 9

How to set up and validate locally

  1. Checkout the branch
  2. Run the following specs spec/models/hooks/service_hook_spec.rb and spec/models/hooks/system_hook_spec.rb
  3. Verify there is performance boost 🚀
Edited by Bojan Marjanovic

Merge request reports

Loading