Commit 824df198 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-repository-migration-validation' into 'master'

E2E: Gitlab migration - validate repository migration

See merge request gitlab-org/gitlab!74678
parents 6695bf1c 13da4f20
...@@ -242,8 +242,7 @@ module QA ...@@ -242,8 +242,7 @@ module QA
end end
def change_repository_storage(new_storage) def change_repository_storage(new_storage)
put_body = { repository_storage: new_storage } response = put(request_url(api_put_path), repository_storage: new_storage)
response = put(request_url(api_put_path), put_body)
unless response.code == HTTP_STATUS_OK unless response.code == HTTP_STATUS_OK
raise( raise(
...@@ -322,11 +321,19 @@ module QA ...@@ -322,11 +321,19 @@ module QA
auto_paginated_response(request_url(api_repository_branches_path, per_page: '100'), attempts: attempts) auto_paginated_response(request_url(api_repository_branches_path, per_page: '100'), attempts: attempts)
end end
def create_repository_branch(branch_name, ref = default_branch)
api_post_to(api_repository_branches_path, branch: branch_name, ref: ref)
end
def repository_tags def repository_tags
response = get(request_url(api_repository_tags_path)) response = get(request_url(api_repository_tags_path))
parse_body(response) parse_body(response)
end end
def create_repository_tag(tag_name, ref = default_branch)
api_post_to(api_repository_tags_path, tag_name: tag_name, ref: ref)
end
def repository_tree def repository_tree
response = get(request_url(api_repository_tree_path)) response = get(request_url(api_repository_tree_path))
parse_body(response) parse_body(response)
......
...@@ -79,7 +79,7 @@ module QA ...@@ -79,7 +79,7 @@ module QA
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2297' testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2297'
) do ) do
expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration)
expect(imported_projects.count).to eq(1), "Expected to have 1 imported project" expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project'
aggregate_failures do aggregate_failures do
expect(imported_projects.first).to eq(source_project) expect(imported_projects.first).to eq(source_project)
...@@ -120,7 +120,7 @@ module QA ...@@ -120,7 +120,7 @@ module QA
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2325' testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2325'
) do ) do
expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration)
expect(imported_projects.count).to eq(1), "Expected to have 1 imported project" expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project'
aggregate_failures do aggregate_failures do
expect(imported_issues.count).to eq(1) expect(imported_issues.count).to eq(1)
...@@ -129,6 +129,59 @@ module QA ...@@ -129,6 +129,59 @@ module QA
end end
end end
end end
context 'with repository' do
let(:imported_project) { imported_projects.first }
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')
imported_group # trigger import
end
it 'successfully imports repository' do
expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration)
expect(imported_projects.count).to eq(1), 'Expected to have 1 imported project'
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
end end
end end
end end
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