diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-06-12 13:29:43 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-06-12 13:30:41 +0200 |
commit | e4612df0e257a27b47986a9ee6aa77f68a9cd3ba (patch) | |
tree | 36ad42e8f6653d3967a44dcf4478ca8828556e7f /spec | |
parent | 450b9f6e30161e6719cf9ffb051b460eb48378c4 (diff) | |
download | gitlab-ce-e4612df0e257a27b47986a9ee6aa77f68a9cd3ba.tar.gz |
Ensure MR diffs always exist in the PR importerpr-importer-io-extra-error-handling
In rare cases it could happen that an MR was created, but creating the
MR diffs somehow failed (e.g. due to an error). This commit adds an
additional check to make sure MR diffs are always present when importing
GitHub pull requests.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb index 6686b7ce0b5..3422a1e82fc 100644 --- a/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb @@ -276,5 +276,17 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi expect(diff.merge_request_diff_commits.exists?).to eq(true) end + + context 'when the merge request exists' do + it 'creates the merge request diffs if they do not yet exist' do + mr, _ = importer.create_merge_request + + mr.merge_request_diffs.delete_all + + importer.insert_git_data(mr, true) + + expect(mr.merge_request_diffs.exists?).to eq(true) + end + end end end |