diff options
author | Rémy Coutable <remy@rymai.me> | 2019-05-09 15:50:07 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-05-09 15:50:07 +0000 |
commit | 389de5e1e49f19ecdcad72992cfe8884b9fc7e60 (patch) | |
tree | 6f92a1600b77858b73b3ddef2c8b368cda51838c | |
parent | 1a90a9bb09138969c784aaf5395456ceaa3e5d89 (diff) | |
parent | 8bd6d0cf8b7e0fa010a57a3c7862318ec5b884f9 (diff) | |
download | gitlab-ce-389de5e1e49f19ecdcad72992cfe8884b9fc7e60.tar.gz |
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
-rw-r--r-- | spec/support/helpers/project_forks_helper.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/support/helpers/project_forks_helper.rb b/spec/support/helpers/project_forks_helper.rb index 9a86560da2a..bcb11a09b36 100644 --- a/spec/support/helpers/project_forks_helper.rb +++ b/spec/support/helpers/project_forks_helper.rb @@ -1,5 +1,11 @@ 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 |