Commit 3c8b77ea authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'ml-add-e2e-test-gitaly-to-praefect-move' into 'master'

Add E2E test of moving a repo from Gitaly to Praefect

See merge request gitlab-org/gitlab!33475
parents 915eb921 034c1fc8
......@@ -165,7 +165,7 @@ module QA
raise ResourceUpdateFailedError, "Could not change repository storage to #{new_storage}. Request returned (#{response.code}): `#{response}`."
end
wait_until(sleep_interval: 1) { Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished') }
wait_until(sleep_interval: 1) { Runtime::API::RepositoryStorageMoves.has_status?(self, 'finished', new_storage) }
rescue Support::Repeater::RepeaterConditionExceededError
raise Runtime::API::RepositoryStorageMoves::RepositoryStorageMovesError, 'Timed out while waiting for the repository storage move to finish'
end
......
......@@ -9,11 +9,11 @@ module QA
RepositoryStorageMovesError = Class.new(RuntimeError)
def has_status?(project, status)
def has_status?(project, status, destination_storage = Env.additional_repository_storage)
all.any? do |move|
move[:project][:path_with_namespace] == project.path_with_namespace &&
move[:state] == status &&
move[:destination_storage_name] == Env.additional_repository_storage
move[:destination_storage_name] == destination_storage
end
end
......
# frozen_string_literal: true
module QA
context 'Create' do
describe 'Changing Gitaly repository storage', :orchestrated, :requires_admin do
shared_examples 'repository storage move' do
it 'confirms a `finished` status after moving project repository storage' do
expect(project).to have_file('README.md')
project.change_repository_storage(destination_storage)
expect(Runtime::API::RepositoryStorageMoves).to have_status(project, 'finished', destination_storage)
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = 'new_file'
push.file_content = '# This is a new file'
push.commit_message = 'Add new file'
push.new_branch = false
end
expect(project).to have_file('README.md')
expect(project).to have_file('new_file')
end
end
context 'when moving from one Gitaly storage to another', :repository_storage do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'repo-storage-move-status'
project.initialize_with_readme = true
end
end
let(:destination_storage) { QA::Runtime::Env.additional_repository_storage }
it_behaves_like 'repository storage move'
end
context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'repo-storage-move'
project.initialize_with_readme = true
project.repository_storage = 'gitaly'
end
end
let(:destination_storage) { QA::Runtime::Env.praefect_repository_storage }
it_behaves_like 'repository storage move'
end
end
end
end
# frozen_string_literal: true
module QA
context 'Create' do
describe 'Gitaly repository storage', :orchestrated, :repository_storage, :requires_admin do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'repo-storage-status'
project.initialize_with_readme = true
end
end
it 'confirms a `finished` status after moving project repository storage' do
expect(project).to have_file('README.md')
project.change_repository_storage(QA::Runtime::Env.additional_repository_storage)
expect(Runtime::API::RepositoryStorageMoves).to have_status(project, 'finished')
Resource::Repository::ProjectPush.fabricate! do |push|
push.project = project
push.file_name = 'new_file'
push.file_content = '# This is a new file'
push.commit_message = 'Add new file'
push.new_branch = false
end
expect(project).to have_file('README.md')
expect(project).to have_file('new_file')
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