Commit 8bd6d0cf authored by Nick Thomas's avatar Nick Thomas

Whitelist Gitaly N+1 for forking in tests

This helper is right on the limit of the number of calls being made.
When the request store is enabled, and Sidekiq is running in inline
mode, just a couple of additional actions result in it being pushed
over the line.

The operation is entirely artificial, since in reality we'd perform
these requests in multiple separate processes, so just whitelist it
for now.
parent 269110b9
module ProjectForksHelper
def fork_project(project, user = nil, params = {})
Gitlab::GitalyClient.allow_n_plus_1_calls do
fork_project_direct(project, user, params)
end
end
def fork_project_direct(project, user = nil, params = {})
# Load the `fork_network` for the project to fork as there might be one that
# wasn't loaded yet.
project.reload unless project.fork_network
......@@ -44,11 +50,16 @@ module ProjectForksHelper
end
def fork_project_with_submodules(project, user = nil, params = {})
forked_project = fork_project(project, user, params)
TestEnv.copy_repo(forked_project,
bare_repo: TestEnv.forked_repo_path_bare,
refs: TestEnv::FORKED_BRANCH_SHA)
forked_project.repository.after_import
forked_project
Gitlab::GitalyClient.allow_n_plus_1_calls do
forked_project = fork_project_direct(project, user, params)
TestEnv.copy_repo(
forked_project,
bare_repo: TestEnv.forked_repo_path_bare,
refs: TestEnv::FORKED_BRANCH_SHA
)
forked_project.repository.after_import
forked_project
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment