Optimize pipeline entity spec
What does this MR do?
This cuts the spec execution time in half for the pipeline entity spec by reducing the number of times we create a project.
This also moves test setup to where it's used if it's only needed in a few tests.
Test prof output:
[TEST PROF INFO] Factories usage
Total: 87
Total top-level: 43
Total time: 8.6029s
Total uniq factories: 8
total top-level total time time per call top-level time name
23 9 5.2574s 0.2286s 3.0683s project
22 0 0.9145s 0.0416s 0.0000s namespace
17 9 0.4465s 0.0263s 0.2711s ci_pipeline
9 9 0.4255s 0.0473s 0.4255s ci_build
8 8 3.7470s 0.4684s 3.7470s merge_request
6 6 1.0407s 0.1735s 1.0407s ci_empty_pipeline
1 1 0.0103s 0.0103s 0.0103s license
1 1 0.0401s 0.0401s 0.0401s user
[TEST PROF INFO] Factories usage
Total: 47
Total top-level: 26
Total time: 3.8649s
Total uniq factories: 8
total top-level total time time per call top-level time name
11 2 2.1298s 0.1936s 0.6437s project
10 0 0.4647s 0.0465s 0.0000s namespace
9 9 0.4728s 0.0525s 0.4728s ci_build
7 5 0.4357s 0.0622s 0.3794s ci_pipeline
6 6 1.1342s 0.1890s 1.1342s ci_empty_pipeline
2 2 1.1788s 0.5894s 1.1788s merge_request
1 1 0.0464s 0.0464s 0.0464s user
1 1 0.0096s 0.0096s 0.0096s license
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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 Grzegorz Bizon