Commit f06d1543 authored by Chloe Liu's avatar Chloe Liu

Merge branch 'acunskis-large-gl-import' into 'master'

E2E: Large repo gitlab migration test

See merge request gitlab-org/gitlab!84450
parents 435f875b 38ecd59d
...@@ -7,10 +7,14 @@ module QA ...@@ -7,10 +7,14 @@ module QA
:destination_group, :destination_group,
:import_id :import_id
attribute :access_token do attribute :import_access_token do
api_client.personal_access_token api_client.personal_access_token
end end
attribute :gitlab_address do
QA::Runtime::Scenario.gitlab_address
end
# In most cases we will want to set path the same as source group # In most cases we will want to set path the same as source group
# but it can be set to a custom name as well when imported via API # but it can be set to a custom name as well when imported via API
attribute :destination_group_path do attribute :destination_group_path do
...@@ -19,18 +23,16 @@ module QA ...@@ -19,18 +23,16 @@ module QA
# Can't define path as attribue since @path is set in base class initializer # Can't define path as attribue since @path is set in base class initializer
alias_method :path, :destination_group_path alias_method :path, :destination_group_path
delegate :gitlab_address, to: 'QA::Runtime::Scenario' def fabricate!
def fabricate_via_browser_ui!
Page::Main::Menu.perform(&:go_to_create_group) Page::Main::Menu.perform(&:go_to_create_group)
Page::Group::New.perform do |group| Page::Group::New.perform do |group|
group.switch_to_import_tab group.switch_to_import_tab
group.connect_gitlab_instance(gitlab_address, api_client.personal_access_token) group.connect_gitlab_instance(gitlab_address, import_access_token)
end end
Page::Group::BulkImport.perform do |import_page| Page::Group::BulkImport.perform do |import_page|
import_page.import_group(path, sandbox.path) import_page.import_group(destination_group_path, sandbox.full_path)
end end
reload! reload!
...@@ -49,7 +51,7 @@ module QA ...@@ -49,7 +51,7 @@ module QA
{ {
configuration: { configuration: {
url: gitlab_address, url: gitlab_address,
access_token: access_token access_token: import_access_token
}, },
entities: [ entities: [
{ {
......
...@@ -343,16 +343,17 @@ module QA ...@@ -343,16 +343,17 @@ module QA
parse_body(response) parse_body(response)
end end
def pipelines
response = get(request_url(api_pipelines_path))
parse_body(response)
end
def pipeline_schedules def pipeline_schedules
response = get(request_url(api_pipeline_schedules_path)) response = get(request_url(api_pipeline_schedules_path))
parse_body(response) parse_body(response)
end end
def pipelines(auto_paginate: false, attempts: 0)
return parse_body(api_get_from(api_pipelines_path)) unless auto_paginate
auto_paginated_response(request_url(api_pipelines_path, per_page: '100'), attempts: attempts)
end
def issues(auto_paginate: false, attempts: 0) def issues(auto_paginate: false, attempts: 0)
return parse_body(api_get_from(api_issues_path)) unless auto_paginate return parse_body(api_get_from(api_issues_path)) unless auto_paginate
...@@ -387,9 +388,7 @@ module QA ...@@ -387,9 +388,7 @@ module QA
api_resource[:import_status] == "finished" api_resource[:import_status] == "finished"
end end
unless mirror_succeeded raise "Mirroring failed with error: #{api_resource[:import_error]}" unless mirror_succeeded
raise "Mirroring failed with error: #{api_resource[:import_error]}"
end
end end
def remove_via_api! def remove_via_api!
......
...@@ -111,7 +111,7 @@ module QA ...@@ -111,7 +111,7 @@ module QA
user.remove_via_api! unless example.exception user.remove_via_api! unless example.exception
next unless defined?(@import_time) next unless defined?(@import_time)
# save data for comparison after run finished # save data for comparison notification creation
save_json( save_json(
"data", "data",
{ {
...@@ -121,26 +121,30 @@ module QA ...@@ -121,26 +121,30 @@ module QA
source: { source: {
name: "GitHub", name: "GitHub",
project_name: github_repo, project_name: github_repo,
branches: gh_branches.length, data: {
commits: gh_commits.length, branches: gh_branches.length,
labels: gh_labels.length, commits: gh_commits.length,
milestones: gh_milestones.length, labels: gh_labels.length,
mrs: gh_prs.length, milestones: gh_milestones.length,
mr_comments: gh_prs.sum { |_k, v| v[:comments].length }, mrs: gh_prs.length,
issues: gh_issues.length, mr_comments: gh_prs.sum { |_k, v| v[:comments].length },
issue_comments: gh_issues.sum { |_k, v| v[:comments].length } issues: gh_issues.length,
issue_comments: gh_issues.sum { |_k, v| v[:comments].length }
}
}, },
target: { target: {
name: "GitLab", name: "GitLab",
project_name: imported_project.path_with_namespace, project_name: imported_project.path_with_namespace,
branches: gl_branches.length, data: {
commits: gl_commits.length, branches: gl_branches.length,
labels: gl_labels.length, commits: gl_commits.length,
milestones: gl_milestones.length, labels: gl_labels.length,
mrs: mrs.length, milestones: gl_milestones.length,
mr_comments: mrs.sum { |_k, v| v[:comments].length }, mrs: mrs.length,
issues: gl_issues.length, mr_comments: mrs.sum { |_k, v| v[:comments].length },
issue_comments: gl_issues.sum { |_k, v| v[:comments].length } issues: gl_issues.length,
issue_comments: gl_issues.sum { |_k, v| v[:comments].length }
}
}, },
not_imported: { not_imported: {
mrs: @mr_diff, mrs: @mr_diff,
...@@ -158,7 +162,7 @@ module QA ...@@ -158,7 +162,7 @@ module QA
start = Time.now start = Time.now
# import the project and log gitlab path # import the project and log gitlab path
Runtime::Logger.info("== Importing project '#{github_repo}' in to '#{imported_project.reload!.full_path}' ==") logger.info("== Importing project '#{github_repo}' in to '#{imported_project.reload!.full_path}' ==")
# fetch all objects right after import has started # fetch all objects right after import has started
fetch_github_objects fetch_github_objects
......
...@@ -4,10 +4,10 @@ module QA ...@@ -4,10 +4,10 @@ module QA
# Disable on live envs until bulk_import_projects toggle is on by default # Disable on live envs until bulk_import_projects toggle is on by default
# Otherwise tests running in parallel can disable feature in the middle of other test # Otherwise tests running in parallel can disable feature in the middle of other test
RSpec.shared_context 'with gitlab project migration', requires_admin: 'creates a user via API', RSpec.shared_context 'with gitlab project migration', requires_admin: 'creates a user via API',
feature_flag: { feature_flag: {
name: 'bulk_import_projects', name: 'bulk_import_projects',
scope: :global scope: :global
} do } do
let(:source_project_with_readme) { false } let(:source_project_with_readme) { false }
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } } let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin } let(:admin_api_client) { Runtime::API::Client.as_admin }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment