blob: 9f6b1d38bd73addb9fb7be5ee50baea3e9f61cad (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# frozen_string_literal: true
module QA
RSpec.describe 'Manage' do
describe 'Gitlab migration', product_group: :import do
include_context 'with gitlab project migration'
# this spec is used as a sanity test for gitlab migration because it can run outside of orchestrated setup
context 'with import within same instance', orchestrated: false, import: false do
let!(:source_project_with_readme) { true }
let!(:source_gitlab_address) { Runtime::Scenario.gitlab_address }
let!(:source_admin_api_client) { admin_api_client }
let!(:source_sandbox) do
Resource::Sandbox.fabricate_via_api! do |group|
group.api_client = admin_api_client
end
end
let!(:target_sandbox) { source_sandbox }
let!(:source_group) do
Resource::Group.fabricate_via_api! do |group|
group.api_client = admin_api_client
group.sandbox = source_sandbox
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end
end
let(:destination_group_path) { "target-group-for-import-#{SecureRandom.hex(4)}" }
let(:cleanup!) { user.remove_via_api! }
it(
'successfully imports project',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/383351'
) do
expect_project_import_finished_successfully
expect(imported_project).to eq(source_project)
end
end
context 'with uninitialized project' do
it(
'successfully imports project',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347610'
) do
expect_project_import_finished_successfully
expect(imported_project).to eq(source_project)
end
end
context 'with repository' do
let(:source_project_with_readme) { true }
let(:source_commits) { source_project.commits.map { |c| c.except(:web_url) } }
let(:source_tags) do
source_project.repository_tags.tap do |tags|
tags.each { |t| t[:commit].delete(:web_url) }
end
end
let(:source_branches) do
source_project.repository_branches.tap do |branches|
branches.each do |b|
b.delete(:web_url)
b[:commit].delete(:web_url)
end
end
end
let(:imported_commits) { imported_project.commits.map { |c| c.except(:web_url) } }
let(:imported_tags) do
imported_project.repository_tags.tap do |tags|
tags.each { |t| t[:commit].delete(:web_url) }
end
end
let(:imported_branches) do
imported_project.repository_branches.tap do |branches|
branches.each do |b|
b.delete(:web_url)
b[:commit].delete(:web_url)
end
end
end
before do
source_project.create_repository_branch('test-branch')
source_project.create_repository_tag('v0.0.1')
end
it(
'successfully imports repository',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347570'
) do
expect_project_import_finished_successfully
aggregate_failures do
expect(imported_commits).to match_array(source_commits)
expect(imported_tags).to match_array(source_tags)
expect(imported_branches).to match_array(source_branches)
end
end
end
context 'with wiki' do
before do
source_project.create_wiki_page(title: 'Import test project wiki', content: 'Wiki content')
end
it(
'successfully imports project wiki',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347567'
) do
expect_project_import_finished_successfully
expect(imported_project.wikis).to eq(source_project.wikis)
end
end
end
end
end
|