Skip to content

Create project forks using factories

Igor Drozdov requested to merge id-create-forks-using-factories into master

What does this MR do?

Related issue: https://gitlab.com/gitlab-org/plan/-/issues/145

Fork of a project takes more than a second in tests (sometimes even 3+ seconds).

Most of the time is spent on Projects::CreateService. If we specify a target project that has been created using a factory, we can avoid calling the service and reduce time to 0.3-0.5s

A new param using_service has been introduce to allow some test to use the previous behaviour; however, we can consider to decouple the behavior even for those cases

The changes should have global impact, but, for example for spec/models/project_spec.rb:

Before

  • Total events: 76389
  • Finished in 4 minutes 12.8 seconds

After

  • Total events: 74029
  • Finished in 3 minutes 29.5 seconds

Queries saved: 2360

Edited by Igor Drozdov

Merge request reports