Commit 389de5e1 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'whitelist-gitaly-when-forking-project' into 'master'

Whitelist Gitaly N+1 for forking in tests

See merge request gitlab-org/gitlab-ce!28225
parents 1a90a9bb 8bd6d0cf
module ProjectForksHelper module ProjectForksHelper
def fork_project(project, user = nil, params = {}) 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 # Load the `fork_network` for the project to fork as there might be one that
# wasn't loaded yet. # wasn't loaded yet.
project.reload unless project.fork_network project.reload unless project.fork_network
...@@ -44,11 +50,16 @@ module ProjectForksHelper ...@@ -44,11 +50,16 @@ module ProjectForksHelper
end end
def fork_project_with_submodules(project, user = nil, params = {}) def fork_project_with_submodules(project, user = nil, params = {})
forked_project = fork_project(project, user, params) Gitlab::GitalyClient.allow_n_plus_1_calls do
TestEnv.copy_repo(forked_project, forked_project = fork_project_direct(project, user, params)
bare_repo: TestEnv.forked_repo_path_bare, TestEnv.copy_repo(
refs: TestEnv::FORKED_BRANCH_SHA) forked_project,
forked_project.repository.after_import bare_repo: TestEnv.forked_repo_path_bare,
forked_project refs: TestEnv::FORKED_BRANCH_SHA
)
forked_project.repository.after_import
forked_project
end
end 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