Commit 8ef5490c authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'fj-fix-bug-project-repository-storage-move' into 'master'

Fix bug in ProjectRepositoryStorageMove transition to scheduled

See merge request gitlab-org/gitlab!49105
parents 446c5ec8 8a2a07cd
......@@ -52,7 +52,7 @@ class ProjectRepositoryStorageMove < ApplicationRecord
begin
storage_move.project.set_repository_read_only!(skip_git_transfer_check: true)
rescue => err
errors.add(:project, err.message)
storage_move.errors.add(:project, err.message)
next false
end
......
---
title: Fix bug in ProjectRepositoryStorageMove transition to scheduled
merge_request: 49105
author:
type: fixed
......@@ -73,6 +73,17 @@ RSpec.describe ProjectRepositoryStorageMove, type: :model do
expect(project).to be_repository_read_only
end
context 'when the transition fails' do
it 'does not trigger ProjectUpdateRepositoryStorageWorker and adds an error' do
allow(storage_move.project).to receive(:set_repository_read_only!).and_raise(StandardError, 'foobar')
expect(ProjectUpdateRepositoryStorageWorker).not_to receive(:perform_async)
storage_move.schedule!
expect(storage_move.errors[:project]).to include('foobar')
end
end
end
context 'and transits to started' do
......
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