Skip to content

Dry up some FactoryBot usage with let_it_be in the EE ProjectsController spec

drew stachon requested to merge ee-project-controller-spec-optimization into master

What does this MR do?

This MR adds some let_it_be usage for user and group, which are never modified or created with different attributes anywhere in the spec. Being simple reference objects, we don't need to re-create them all the time.

FPROF Reports

Before

Finished in 2 minutes 36.8 seconds (files took 40.89 seconds to load)
59 examples, 0 failures

[TEST PROF INFO] Factories usage

 Total: 241
 Total top-level: 152
 Total time: 16.1845s
 Total uniq factories: 6

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

      83          70        4.5774s            0.0551s             4.1268s               user
      68          68       11.7074s            0.1722s            11.7074s            project
      63           0        3.1427s            0.0499s             0.0000s          namespace
      13          13        0.3416s            0.0263s             0.3416s              group
      13           0        0.0511s            0.0039s             0.0000s namespace_settings
       1           1        0.0087s            0.0087s             0.0087s            license

After

Finished in 2 minutes 20.8 seconds (files took 42.58 seconds to load)
59 examples, 0 failures

[TEST PROF INFO] Factories usage

 Total: 145
 Total top-level: 71
 Total time: 11.6286s
 Total uniq factories: 6

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

      64          64       11.3587s            0.1775s            11.3587s            project
      59           0        2.7130s            0.0460s             0.0000s          namespace
      17           4        0.6388s            0.0376s             0.2106s               user
       2           2        0.0516s            0.0258s             0.0516s              group
       2           0        0.0083s            0.0041s             0.0000s namespace_settings
       1           1        0.0078s            0.0078s             0.0078s            license

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

Merge request reports

Loading