Commit ff462603 authored by Gabriel Mazetto's avatar Gabriel Mazetto

when rollingback repository migration, toggle readonly mode back

parent dd634fec
...@@ -22,8 +22,8 @@ module Projects ...@@ -22,8 +22,8 @@ module Projects
private private
def move_folder!(old_path, new_path) def move_folder!(old_path, new_path)
unless File.exist?(old_path) unless File.directory?(old_path)
logger.info("Skipped attachments migration from '#{old_path}' to '#{new_path}', source path doesn't exist (PROJECT_ID=#{project.id})") logger.info("Skipped attachments migration from '#{old_path}' to '#{new_path}', source path doesn't exist or is not a directory (PROJECT_ID=#{project.id})")
return return
end end
......
...@@ -31,7 +31,7 @@ module Projects ...@@ -31,7 +31,7 @@ module Projects
unless result unless result
rollback_folder_move rollback_folder_move
return result project.storage_version = nil
end end
project.repository_read_only = false project.repository_read_only = false
......
...@@ -48,18 +48,20 @@ describe Projects::HashedStorage::MigrateRepositoryService do ...@@ -48,18 +48,20 @@ describe Projects::HashedStorage::MigrateRepositoryService do
expect(gitlab_shell.exists?(project.repository_storage_path, "#{hashed_storage.disk_path}.git")).to be_falsey expect(gitlab_shell.exists?(project.repository_storage_path, "#{hashed_storage.disk_path}.git")).to be_falsey
expect(gitlab_shell.exists?(project.repository_storage_path, "#{hashed_storage.disk_path}.wiki.git")).to be_falsey expect(gitlab_shell.exists?(project.repository_storage_path, "#{hashed_storage.disk_path}.wiki.git")).to be_falsey
expect(project.repository_read_only?).to be_falsey
end end
context 'when rollback fails' do context 'when rollback fails' do
before do let(:from_name) { legacy_storage.disk_path }
from_name = legacy_storage.disk_path let(:to_name) { hashed_storage.disk_path }
to_name = hashed_storage.disk_path
before do
hashed_storage.ensure_storage_path_exists hashed_storage.ensure_storage_path_exists
gitlab_shell.mv_repository(project.repository_storage_path, from_name, to_name) gitlab_shell.mv_repository(project.repository_storage_path, from_name, to_name)
end end
it 'does not try to move nil repository over hashed' do it 'does not try to move nil repository over hashed' do
expect(gitlab_shell).not_to receive(:mv_repository).with(project.repository_storage_path, from_name, to_name)
expect_move_repository("#{project.disk_path}.wiki", "#{hashed_storage.disk_path}.wiki") expect_move_repository("#{project.disk_path}.wiki", "#{hashed_storage.disk_path}.wiki")
service.execute service.execute
......
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