blob: 9dce9bff3c106ad1a9b96475124418dd0f9c2725 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# frozen_string_literal: true
require_relative 'gitlab_project_migration_common'
module QA
RSpec.describe 'Manage', :requires_admin do
describe 'Gitlab migration', quarantine: {
only: { job: 'praefect' },
type: :investigating,
issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/348999'
} do
include_context 'with gitlab project migration'
context 'with merge request' do
let!(:source_project_with_readme) { true }
let!(:other_user) do
Resource::User
.fabricate_via_api! { |usr| usr.api_client = admin_api_client }
.tap do |usr|
usr.set_public_email
source_project.add_member(usr, Resource::Members::AccessLevel::MAINTAINER)
end
end
let!(:source_mr) do
Resource::MergeRequest.fabricate_via_api! do |mr|
mr.project = source_project
mr.api_client = Runtime::API::Client.new(user: other_user)
end
end
let!(:source_comment) { source_mr.add_comment('This is a test comment!') }
let(:imported_mrs) { imported_project.merge_requests }
let(:imported_mr_comments) { imported_mr.comments }
let(:imported_mr) do
Resource::MergeRequest.init do |mr|
mr.project = imported_project
mr.iid = imported_mrs.first[:iid]
mr.api_client = api_client
end
end
after do
other_user.remove_via_api!
end
it(
'successfully imports merge request',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348478'
) do
expect_import_finished
aggregate_failures do
expect(imported_mrs.count).to eq(1)
# TODO: remove custom comparison after member migration is implemented
# https://gitlab.com/gitlab-org/gitlab/-/issues/341886
expect(imported_mr.comparable.except(:author)).to eq(source_mr.reload!.comparable.except(:author))
expect(imported_mr_comments.count).to eq(1)
expect(imported_mr_comments.first[:body]).to include(source_comment[:body])
# Comment will have mention of original user since members are not migrated yet
expect(imported_mr_comments.first[:body]).to include(other_user.name)
end
end
end
end
end
end
|