Speed up Projects::JobsController spec
What does this MR do and why?
Speed up Projects::JobsController spec, reducing the total time from 15 minutes to 2 minutes.
Creating a project is very expensive on Gitaly calls. Before the change, the total test time is 15m09s, 49% of which is spent on GRPC::Core::Call#run_batch
.
Measure Mode: wall_time
Thread ID: 21360
Total: 904.340032
Sort by: self_time
%self total self wait child calls name location
49.47 475.381 447.343 28.029 0.009 10631 GRPC::Core::Call#run_batch
7.43 67.167 67.166 0.000 0.001 62673 Kernel#caller
2.95 26.718 26.718 0.000 0.000 36212 IO#read
This changes the test such that the project and users are created once in the entire tests. Each test can switch between the user roles in order to test the permission level.
As a result, the total test time is now 2m29s and GRPC::Core::Call#run_batch
only takes 6.48% of it.
Measure Mode: wall_time
Thread ID: 21360
Total: 156.224170
Sort by: self_time
%self total self wait child calls name location
12.45 19.459 19.457 0.000 0.002 30856 Kernel#caller
6.48 10.128 10.126 0.000 0.002 1601 GRPC::Core::Call#run_batch
3.58 5.590 5.590 0.000 0.000 11517 PG::Connection#exec_params
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.