Skip to content

CoverageReportsController spec optimization

drew stachon requested to merge coverage-controller-spec-perf into master

What does this MR do?

This MR makes a few performance improvements to a spec file I wrote recently. The overall size is small, but the setup will allow additional tests to be written with minimal additional overhead.

FPROF

Before

[TEST PROF INFO] Factories usage

 Total: 83
 Total top-level: 32
 Total time: 3.4802s
 Total uniq factories: 8

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

      19           6        2.7953s            0.1471s             0.9934s            project
      13          13        2.1014s            0.1616s             2.1014s ci_daily_build_group_report_result
      13           0        0.3979s            0.0306s             0.0000s          namespace
      13           0        2.0412s            0.1570s             0.0000s        ci_pipeline
      12           6        0.5220s            0.0435s             0.1520s               user
       6           0        0.0258s            0.0043s             0.0000s namespace_settings
       6           6        0.2189s            0.0365s             0.2189s              group
       1           1        0.0144s            0.0144s             0.0144s            license

After

[TEST PROF INFO] Factories usage

 Total: 18
 Total top-level: 7
 Total time: 1.2757s
 Total uniq factories: 8

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

       4           1        0.9688s            0.2422s             0.4763s            project
       3           0        0.0985s            0.0328s             0.0000s          namespace
       3           3        0.6217s            0.2072s             0.6217s ci_daily_build_group_report_result
       3           0        0.5929s            0.1976s             0.0000s        ci_pipeline
       2           1        0.2512s            0.1256s             0.1183s               user
       1           1        0.0111s            0.0111s             0.0111s            license
       1           1        0.0484s            0.0484s             0.0484s              group
       1           0        0.0041s            0.0041s             0.0000s namespace_settings

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 drew stachon

Merge request reports