Skip to content

Avoid persisting subject for faster MR association tests

John Hope requested to merge jh-use-non-persisted-subject-merge-requests into master

What does this MR do?

Merge Request association testing uses an implicit subject that is persisted. This can be avoided since it's not necessary to write the row just to test the associations.

Because of the way factories cascade, this removes 1249 1904 database queries and speeds up these examples by 60-80%.

Demonstration for the rspec profiling project.

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 John Hope

Merge request reports