Skip to content

Speed up pipeline seed build spec

Peter Leitzen requested to merge pl-spec-lib-pipeline-seed-build-perf into master

What does this MR do?

This MR improves the performance of CI pipeline seed build spec by using let_it_be.

Related to &3752.

It also contributes to #220040 (closed).

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

  • Total amount of factories created went down from 712 to 3 🚀
  • Total time dropped from ~1 minute to ~16 seconds
  • Total events went down from 22457 to 1537
  • Queries saved: 20920

Before

[TEST PROF INFO] EventProf results for sql.active_record

Total time: 00:31.928 of 01:08.844 (46.38%)
Total events: 22457

Top 5 slowest suites (by time):

Gitlab::Ci::P...e::Seed::Build (./spec/lib/gitlab/ci/pipeline/seed/build_spec.rb:5) – 00:31.928 (22457 / 273) of 01:08.844 (46.38%)



Finished in 1 minute 16.2 seconds (files took 2.87 seconds to load)
273 examples, 0 failures

[TEST PROF INFO] Factories usage

 Total: 712
 Total top-level: 439
 Total time: 58.1003s
 Total uniq factories: 5

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

     273         273       53.7868s            0.1970s            53.7868s            project
     273           0       13.3876s            0.0490s             0.0000s          namespace
     117         117        2.9676s            0.0254s             2.9676s  ci_empty_pipeline
      48          48        1.3346s            0.0278s             1.3346s        ci_pipeline
       1           1        0.0113s            0.0113s             0.0113s            license

After

Total time: 00:02.199 of 00:08.865 (24.81%)
Total events: 1537

Top 5 slowest suites (by time):

Gitlab::Ci::P...e::Seed::Build (./spec/lib/gitlab/ci/pipeline/seed/build_spec.rb:5) – 00:02.199 (1537 / 273) of 00:08.865 (24.81%)



Finished in 16.31 seconds (files took 2.78 seconds to load)
273 examples, 0 failures

[TEST PROF INFO] Factories usage

 Total: 3
 Total top-level: 2
 Total time: 0.5562s
 Total uniq factories: 3

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

       1           1        0.0070s            0.0070s             0.0070s            license
       1           1        0.5492s            0.5492s             0.5492s            project
       1           0        0.1011s            0.1011s             0.0000s          namespace

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Leitzen

Merge request reports