summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-06-14 07:06:32 +0000
committerAsh McKenzie <amckenzie@gitlab.com>2019-06-14 07:06:32 +0000
commit286a593849d1ee1b9908fd924d8272a5e03375df (patch)
tree2c451fe9bf4d6e2fa9cc327372f9d6ca357bfcb0
parent56c365bde8da581d2a3a8973bc60ed1b8f0e502e (diff)
parent265e52bb80bda8bb5c894a69716d795620fd27a3 (diff)
downloadgitlab-ce-286a593849d1ee1b9908fd924d8272a5e03375df.tar.gz
Merge branch 'gitea_import_ignore_pull_request_comments' into 'master'
Don't import pull request comments from Gitea repos Closes #63071 See merge request gitlab-org/gitlab-ce!29521
-rw-r--r--lib/gitlab/legacy_github_import/importer.rb7
-rw-r--r--spec/lib/gitlab/legacy_github_import/importer_spec.rb19
2 files changed, 16 insertions, 10 deletions
diff --git a/lib/gitlab/legacy_github_import/importer.rb b/lib/gitlab/legacy_github_import/importer.rb
index 70b18221a66..751726d4810 100644
--- a/lib/gitlab/legacy_github_import/importer.rb
+++ b/lib/gitlab/legacy_github_import/importer.rb
@@ -55,7 +55,12 @@ module Gitlab
import_pull_requests
import_issues
import_comments(:issues)
- import_comments(:pull_requests)
+
+ # Gitea doesn't have an API endpoint for pull requests comments
+ unless project.gitea_import?
+ import_comments(:pull_requests)
+ end
+
import_wiki
# Gitea doesn't have a Release API yet
diff --git a/spec/lib/gitlab/legacy_github_import/importer_spec.rb b/spec/lib/gitlab/legacy_github_import/importer_spec.rb
index 6bc3792eb22..a0c664da185 100644
--- a/spec/lib/gitlab/legacy_github_import/importer_spec.rb
+++ b/spec/lib/gitlab/legacy_github_import/importer_spec.rb
@@ -13,21 +13,22 @@ describe Gitlab::LegacyGithubImport::Importer do
expected_called = [
:import_labels, :import_milestones, :import_pull_requests, :import_issues,
- :import_wiki, :import_releases, :handle_errors
+ :import_wiki, :import_releases, :handle_errors,
+ [:import_comments, :issues],
+ [:import_comments, :pull_requests]
]
expected_called -= expected_not_called
aggregate_failures do
- expected_called.each do |method_name|
- expect(importer).to receive(method_name)
+ expected_called.each do |method_name, arg|
+ base_expectation = proc { expect(importer).to receive(method_name) }
+ arg ? base_expectation.call.with(arg) : base_expectation.call
end
- expect(importer).to receive(:import_comments).with(:issues)
- expect(importer).to receive(:import_comments).with(:pull_requests)
-
- expected_not_called.each do |method_name|
- expect(importer).not_to receive(method_name)
+ expected_not_called.each do |method_name, arg|
+ base_expectation = proc { expect(importer).not_to receive(method_name) }
+ arg ? base_expectation.call.with(arg) : base_expectation.call
end
end
@@ -289,7 +290,7 @@ describe Gitlab::LegacyGithubImport::Importer do
end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute' do
- let(:expected_not_called) { [:import_releases] }
+ let(:expected_not_called) { [:import_releases, [:import_comments, :pull_requests]] }
end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute an error occurs'
it_behaves_like 'Gitlab::LegacyGithubImport unit-testing'